Skip to content

Instantly share code, notes, and snippets.

@JackyLiu97
Created October 6, 2020 02:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JackyLiu97/c091a800ccac7441d7d92048aebc5365 to your computer and use it in GitHub Desktop.
Save JackyLiu97/c091a800ccac7441d7d92048aebc5365 to your computer and use it in GitHub Desktop.
Hosting my own addblock for twitch
# https://github.com/uBlockOrigin/uAssets/pull/3517
twitch-videoad.js application/javascript
(function() {
if ( /(^|\.)twitch\.tv$/.test(document.location.hostname) === false ) { return; }
var realFetch = window.fetch;
window.fetch = function(input, init) {
if ( arguments.length >= 2 && typeof input === 'string' && input.includes('/access_token') ) {
var url = new URL(arguments[0]);
url.searchParams.forEach(function(value, key) {
url.searchParams.delete(key);
});
arguments[0] = url.href;
}
return realFetch.apply(this, arguments);
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment