Skip to content

Instantly share code, notes, and snippets.

@stugmi
Created January 21, 2024 00:45
Show Gist options
  • Save stugmi/2466c137d55662df7f750d0dfb5b2f62 to your computer and use it in GitHub Desktop.
Save stugmi/2466c137d55662df7f750d0dfb5b2f62 to your computer and use it in GitHub Desktop.
[ActionScript] Twitch sub only VOD bypass
// ==UserScript==
// @name NoSubVod
// @author smug
// @description free vods
// @version 1.0.0
// @match https://www.twitch.tv/*
// @include https://cdn.jsdelivr.net/gh/besuper/*/src/amazon-ivs-worker.min.js
// @grant GM.webRequest
// @run-at document-start
// ==/UserScript==
// Patching amazon service worker
const app = (cdnLink) => {
// redirect rules for aws worker
const rule = {
selector: "https://static.twitchcdn.net/assets/amazon-ivs-wasmworker.min-*.js",
action: {
redirect: {
from: "https://static.twitchcdn.net/assets/amazon-ivs-wasmworker.min-(\\w+)\.js",
to: cdnLink
},
},
};
// hooks for webrequest
GM.webRequest([rule], function(info, message, events) {
console.log(info, message, events);
console.log("[DONGS]: redirected aws worker request", cdnLink);
});
};
(async () => {
// Fetching current CDN link
try {
const response = await fetch("https://api.github.com/repos/besuper/TwitchNoSub/commits");
const content = await response.json();
var latestCommit = content[0].sha;
console.log("Lastest commit sha: " + latestCommit);
cdnLink = `https://cdn.jsdelivr.net/gh/besuper/TwitchNoSub@${latestCommit}/src/amazon-ivs-worker.min.js`;
} catch (e) {
// fallback
console.log(e);
cdnLink = `https://cdn.jsdelivr.net/gh/besuper/TwitchNoSub/src/amazon-ivs-worker.min.js`;
}
console.log("CDN link : " + cdnLink);
app(cdnLink);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment