Skip to content

Instantly share code, notes, and snippets.

@jkmartindale
Last active March 1, 2025 08:28
Show Gist options
  • Save jkmartindale/c2a2cb83e6a2e889c7e3aa7b37b5fedc to your computer and use it in GitHub Desktop.
Save jkmartindale/c2a2cb83e6a2e889c7e3aa7b37b5fedc to your computer and use it in GitHub Desktop.
Paste this into your browser console to hopefully start earning rewards. Forum thread: https://web.archive.org/web/20230922092451/https%3A%2F%2Fna.alienwarearena.com%2Fucf%2Fshow%2F2167631
/* Twitch Quest Fixer v3.1 */
const extensionID = "ehc5ey5g9hoehi8ys54lr6eknomqgr";
const channel = location.pathname.slice(1).toLowerCase();
const channelId = __APOLLO_CLIENT__.cache.data.data.ROOT_QUERY["channel({\"name\":\""+channel+"\"})"].__ref.split(":")[1];
const pollDuration = 60000;
let authToken = __APOLLO_CLIENT__.cache.data.data["Channel:" + channelId].selfInstalledExtensions.filter(x => x.helixToken.extensionID == extensionID)[0].token.jwt;
grantPermission = async () => {
console.log("Attempting to grant permission automatically...");
const integrityResponse = await (await fetch("https://gql.twitch.tv/integrity", { method: "post", headers: commonOptions.headers })).json();
const integrity = integrityResponse.token;
const permissionResponse = await (await fetch("https://gql.twitch.tv/gql", {
method: "post",
headers: {
...commonOptions.headers, ...{
"Client-Integrity": integrity
}
},
body: JSON.stringify([{
"operationName": "LinkUserMutation",
"variables": {
"channelID": channelId,
"extensionID": extensionID,
"token": authToken,
"showUser": true
},
"extensions": { "persistedQuery": { "version": 1, "sha256Hash": "b5dfec96759d42ac5a24f79beec27bcdf90e936e0fac4f727b7ab36dadb6a22a" } }
}])
})).json();
console.log(permissionResponse);
newAuthToken = permissionResponse[0].data.extensionLinkUser.token.jwt;
if (newAuthToken) {
authToken = newAuthToken;
console.log("Looks like permission was successfully granted. You should see another message saying that you're earning ARP about 60 seconds from now.");
};
}
handlePolling = () => {
fetch("https://alienware.jkmartindale.dev/?url=https://www.alienwarearena.com/twitch/extensions/track", {
method: 'GET',
headers: {
'x-extension-jwt': authToken,
'x-extension-channel': channelId
}
})
.then(response => response.json())
.then(async data => {
console.log(data);
/* Attempt to authorize extension if not authorized */
if (data.state === "grant_permission") {
await grantPermission();
};
})
.catch((err) => {
console.log(err);
})
.finally(() => {
setTimeout(handlePolling, pollDuration);
});
};
handlePolling()
@phrostb
Copy link

phrostb commented Feb 19, 2025

so we can just pause the stream and keep it in a hidden tab, and it'll still count? i often have trouble with keeping my ARP twitch count going

@jkmartindale
Copy link
Author

so we can just pause the stream and keep it in a hidden tab, and it'll still count? i often have trouble with keeping my ARP twitch count going

The way the AWA widget is designed and intended to work, yes. All you should need to do is get the stream running, and scroll down to load the panel if the streamer is still using the old widget that isn't the overlay. As soon as the widget is loaded, it runs in a loop every minute to ping AWA to tell them who you're watching and get you some ARP.

However, different browsers on different devices and with different settings treat inactive tabs differently. Some of them slow down the timer, some of them may sleep an inactive tab after a period of time. I've personally never had issues leaving the stream on and then playing a game or something, but I have a decent bit of RAM and afaik disabled suspending inactive tabs in Chrome.

There's been people reporting slow ARP earnings. Some of them are people who never got the memo that only Hive streamers give 0.4 ARP/min and the rest 0.2 ARP/min, but some of them seem to be people legitimately encountering a slowdown. I've never really noticed because I let the stream go for however long and then I come back a couple hours later and it's done. So no clue what else is or is not happening.

@phrostb
Copy link

phrostb commented Feb 28, 2025

today i literally got 0 ARP in firefox..

Uncaught ReferenceError: APOLLO_CLIENT is not defined
debugger eval code:4
debugger eval code:4:19
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.sprig.com/sdk/1/environments/zIy65lh0OA/config. (Reason: CORS request did not succeed). Status code: (null).

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.sprig.com/sdk/1/environments/zIy65lh0OA/config. (Reason: CORS request did not succeed). Status code: (null).

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.sprig.com/sdk/1/environments/zIy65lh0OA/config. (Reason: CORS request did not succeed). Status code: (null).

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.sprig.com/sdk/1/environments/zIy65lh0OA/config. (Reason: CORS request did not succeed). Status code: (null).

UserLeap - Disabled: failed to fetch configuration vendor.sprig-controller.min.js-bcc43c50eaa7ca69183b.js:1:27259
UserLeap - Disabled: failed to fetch configuration vendor.sprig-controller.min.js-bcc43c50eaa7ca69183b.js:1:27259
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.sprig.com/sdk/1/errors. (Reason: CORS request did not succeed). Status code: (null).

UserLeap - Disabled: failed to fetch configuration vendor.sprig-controller.min.js-bcc43c50eaa7ca69183b.js:1:27259
[Sprig] (ERR-444) Failed to report error to API TypeError: NetworkError when attempting to fetch resource. vendor.sprig-controller.min.js-bcc43c50eaa7ca69183b.js:1:171948
21:11:40 - [VideoTransformer] WebGPU unavailable player-core-variant-b-abb06cd8c786cc1a0940.js:1:31732
Amazon IVS Player SDK 1.38.0-rc.2 amazon-ivs-wasmworker.min-4ca0f140b1a435d8fec3.js:1:49847
MediaCapabilities found
Array [ {…}, {…} ]
amazon-ivs-wasmworker.min-4ca0f140b1a435d8fec3.js:1:105572
InstallTrigger is deprecated and will be removed in the future. nat.min.js:6901:35
WEBGL_debug_renderer_info is deprecated in Firefox and will be removed. Please use RENDERER. nat.min.js:7447:21
Use of the orientation sensor is deprecated. nat.min.js:3415:19
Moving to buffered region 0.005666 0 player-core-variant-b-abb06cd8c786cc1a0940.js:1:61952

@jkmartindale
Copy link
Author

Uncaught ReferenceError: APOLLO_CLIENT is not defined

Looks like Twitch just changed something that broke how API queries are handled. Honestly surprised that code worked as long as it did because it was a bit of a hack. I'm AFK on international travel for a bit but I'll take a look eventually. I'm honestly surprised people still feel a need to use this.

Can you send a screenshot of the AWA panel? Just curious what it's saying that is making you try this ancient script.

@phrostb
Copy link

phrostb commented Feb 28, 2025 via email

@Silentrets
Copy link

Silentrets commented Feb 28, 2025

Uncaught ReferenceError: APOLLO_CLIENT is not defined
at :4:19

i cant see success message and i cannot take ARP anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment