Skip to content

Instantly share code, notes, and snippets.

@ClaireNeveu
Last active November 3, 2020 17:51
Show Gist options
  • Save ClaireNeveu/d90c3239754d7f4fe68cf459a8b3f0b6 to your computer and use it in GitHub Desktop.
Save ClaireNeveu/d90c3239754d7f4fe68cf459a8b3f0b6 to your computer and use it in GitHub Desktop.
ublock userResource
/// twitch-videoad.js
const origFetch = window.fetch;
window.fetch = (url, init, ...args) => {
if (typeof url === "string") {
if (url.includes("/access_token")) {
url = url.replace("player_type=site", "player_type=thunderdome");
} else if (
url.includes("/gql") &&
init &&
typeof init.body === "string" &&
init.body.includes("PlaybackAccessToken")
) {
const newBody = JSON.parse(init.body);
newBody.variables.playerType = "thunderdome";
init.body = JSON.stringify(newBody);
}
}
return origFetch(url, init, ...args);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment