-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patharsenal.php
45 lines (40 loc) · 1.41 KB
/
arsenal.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
require "common.php";
$ch = curl_init("https://gql.twitch.tv/gql");
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => [
"Client-Id: kimne78kx3ncx6brgo4mv6wki5h1ko"
],
CURLOPT_POSTFIELDS => '[{"operationName":"ExtensionsForChannel","variables":{"channelID":"123858856"},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"d52085e5b03d1fc3534aa49de8f5128b2ee0f4e700f79bf3875dcb1c90947ac3"}}}]',
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
// var_dump($data);
foreach ($data[0]['data']['user']['channel']['selfInstalledExtensions'] as $ext)
{
if ($ext['token']['extensionID'] == "ud1zj704c0eb1s553jbkayvqxjft97")
{
$jwt = $ext['token']['jwt'];
break;
}
}
if (!$jwt)
{
http_response_code(500);
die("Failed to obtain token.");
}
$ch = curl_init("https://".$platform_api[$platform]."/dynamic/twitch/getActiveLoadout.php?account=".strtolower($_GET["account"]));
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => [
"Origin: https://ud1zj704c0eb1s553jbkayvqxjft97.ext-twitch.tv",
"Referer: https://ud1zj704c0eb1s553jbkayvqxjft97.ext-twitch.tv",
"Authorization: Bearer ".$jwt
],
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
header("Content-Type: application/json");
echo json_encode(json_decode($response, true), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);