Last active
December 28, 2025 08:58
-
-
Save t0rr3sp3dr0/affec5cb71de89b7fe6226374852f40d to your computer and use it in GitHub Desktop.
Block Ads via NSSurge
This file contains hidden or 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
| [URL Rewrite] | |
| "https://.+[.]ads[.]twitch[.]tv/.+" - reject | |
| "https://.+[.]api[.]amazonvideo[.]com/cdp/getVideoAds[?].+" - reject | |
| "https://.+[.]prime-video[.]amazon[.]dev/getVideoAds[?].+" - reject | |
| "https://.+[.]cdn[.]peacocktv[.]com/intmvpvod/.+[.]m3u8[?](.+&)?vam_params=.+" - reject | |
| [MITM] | |
| hostname = disney.playback.edge.bamgrid.com, dynamic-manifest.hulustream.com, *.ads.twitch.tv, *.api.amazonvideo.com, *.prime-video.amazon.dev, *.cdn.peacocktv.com | |
| [Script] | |
| Disney+ = type=http-response,pattern=https://disney[.]playback[.]edge[.]bamgrid[.]com/v7/playback/.+,requires-body=1,max-size=2097152,binary-body-mode=0,script-path=https://gist.github.com/t0rr3sp3dr0/affec5cb71de89b7fe6226374852f40d/raw/Disney+.js,script-update-interval=300 |
This file contains hidden or 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
| let body = JSON.parse($response.body); | |
| body['stream']['insertion']['points'] = []; | |
| $done({ body: JSON.stringify(body) }); |
This file contains hidden or 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
| let body = $response.body; | |
| let ad = false; | |
| let startD = 0; | |
| let offset = 0; | |
| let lines = []; | |
| for (let line of body.split('\n')) { | |
| if (line.startsWith('#EXT-X-DATERANGE:')) { | |
| const startD0 = (new Date(line.match(/,START-DATE="([^"]+)"/)[1])).getTime(); | |
| if (ad) { | |
| offset += startD0 - startD; | |
| } | |
| startD = startD0; | |
| ad = line.includes(',X-COM-HULU-CONTENT-MANIFEST-PERIOD-TYPE-2018="ad"'); | |
| if (!ad) { | |
| const startD1 = (new Date(startD0 - offset)).toISOString(); | |
| line = line.replace(/,START-DATE="[^"]+"/, `,START-DATE="${startD1}"`); | |
| } | |
| } | |
| if (!ad) { | |
| lines.push(line); | |
| } | |
| } | |
| $done({ body: lines.join('\n') }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment