Last active
November 5, 2020 04:05
-
-
Save csymlstd/54aee096f5f9a3949b5805dff65766a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 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