Skip to content

Instantly share code, notes, and snippets.

@stoically
Created March 20, 2019 17:58
Show Gist options
  • Save stoically/b9f145195734768c2dcc773c558607a8 to your computer and use it in GitHub Desktop.
Save stoically/b9f145195734768c2dcc773c558607a8 to your computer and use it in GitHub Desktop.
browser.webRequest.onBeforeRequest.addListener(details => {
console.log('url', details.url);
const url = new URL(details.url);
const token = JSON.parse(decodeURIComponent(url.searchParams.get('token')));
token.show_ads = false;
token.server_ads = false;
token.hide_ads = true;
url.searchParams.set('token', JSON.stringify(token));
console.log('redirectUrl', url.href);
return {redirectUrl: url.href};
}, {urls: ['https://usher.ttvnw.net/api/channel/hls/*.m3u8?*'], types: ['xmlhttprequest']}, ['blocking']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment