max / Twitch Ad Remover

Install steps: Install a userscript manager, select Install, then open a website matched by the script.

Userscript HOWTO за начинаещи Chrome Edge Firefox

Публикувано:

Версия: 1.1.1+eca848b

Резюме: Blocks Twitch display ads and replaces server-side-inserted video ads with a clean stream

Лиценз: MIT

Антифункция: неуточнено

Source and freshness

The following figures come from the original source and are separate from activity on this site.

Original script: Twitch Ad Remover

Source version: 1.1.1

Last source check:

Last successful check:

Source daily installs
0
Source total installs
0
OpenUserJS install requests
0

Requests received by this site are not proof that a user completed installation.

Clicking Install records a request on this site; it does not confirm installation. Not working after install? View troubleshooting and issues

Twitch Ad Remover

Removes advertising from Twitch.tv, including the ads that play inside the video player.

Unlike a normal content blocker, this does not simply hide the ad — it replaces the advertised stream with a clean one before the player ever receives it. You keep watching the broadcast without an interruption, a black screen, or a mute.


Why a normal ad blocker isn't enough

Twitch uses server-side ad insertion (SSAI). Ads are not separate requests to a separate ad server; they are spliced directly into the HLS manifest as ordinary video segments, on the same CDN, indistinguishable at the network level from the stream itself.

A filter list has nothing to block. A cosmetic rule has nothing to hide. By the time the ad is visible, it is already part of the video the player is decoding.

How it works

Twitch's player runs its HLS logic inside a Web Worker. This script overrides window.Worker at document-start, reads the worker's bootstrap blob, and injects its own fetch hook ahead of the original worker code.

Inside the worker:

  1. Every .m3u8 playlist is inspected for stitched-ad markers before it reaches the player.
  2. When markers are found, a fresh PlaybackAccessToken is requested through Twitch's GraphQL API with platform: "ios" and an alternate playerType. Twitch does not apply the same ad stitching policy to every platform and player type combination.
  3. The resulting master playlist is scanned for the encoding matching your current resolution and frame rate, and that clean playlist is returned to the player in place of the advertised one.
  4. If the first player type still returns ads, the script escalates through the remaining ones.

Because the substitution happens upstream of the player, no ad segment is ever buffered or rendered.

Supporting behaviour:

  • Client headers (Client-ID, Client-Integrity, Client-Version, Client-Session-Id, Device-ID, Authorization) are harvested from the page's own requests and forwarded to the worker, so token requests carry valid credentials and pass integrity checks.
  • The player type that last produced a clean stream is remembered and tried first on subsequent breaks.
  • Failed token requests back off exponentially rather than retrying every two seconds.
  • Page visibility is spoofed so Twitch does not pause playback in a background tab.
  • Banner ads, ad overlays and third-party ad-network requests are blocked conventionally.
  • picture-by-picture probes are suppressed, since they retrigger mid-roll logic.

Failure behaviour

The playlist interceptor runs inside a guarded block. Any unhandled error falls through to the browser's own fetch, and after five consecutive failures the hook disables itself for the remainder of the session.

This is deliberate. When Twitch changes something upstream, the script degrades to ads play normally — never to a black or frozen player.

If another Twitch ad blocking script is already active, this one detects it through the shared window.twitchAdSolutionsVersion marker and stands down rather than competing with it. Running two at once makes both less effective.

Latency correction

Substituting a stream leaves the player holding a stale buffer, and live latency drifts. The script checks latency every 30 seconds, on tab focus, and after each ad break, and performs a pause/play cycle to reseek to the live edge when latency exceeds the threshold — 5 seconds in low-latency mode, 15 seconds otherwise.

A 30-second cooldown prevents repeated cycling, and VODs, clips and collections are excluded.

Logging

Console output uses labelled badges: script name, level, and source context.

AdRemover  INFO   Page     v1.1.1 active, playerTypes: embed → site → autoplay
AdRemover  OK     Worker   Clean stream via playerType "embed"
AdRemover  WARN   Worker   Token request failed (403), retrying in 4s
AdRemover  INFO   Player   Latency 18.4s exceeded 15s, resynced to live edge

Levels are debug, info, ok, warn, error. Contexts are Page, Worker, Player, Net. Worker-side events are relayed to the page so everything lands in one console.

Set logLevel to 'debug' when reporting a problem, or 'silent' to suppress output entirely.

Configuration

Edit the CFG object at the top of the script.

Option Default Purpose
playerTypes ['embed', 'site', 'autoplay'] Player types tried, in order, when requesting a clean stream.
encodingCacheTimeout 60000 How long (ms) a fetched master playlist is reused before requesting a new token.
stickyPlayerType true Remember and reuse the last working player type.
tokenBackoffBase 2000 Initial backoff (ms) after a failed token request.
tokenBackoffMax 60000 Backoff ceiling (ms).
maxConsecutiveErrors 5 Errors tolerated before the hook disables itself for the session.
consumeAdSegment true Requests one ad segment to mark the pod consumed, which reduces pre-roll frequency.
hideBannerAds true Injects CSS to hide display ads and ad overlays.
blockAdNetworks true Blocks requests to third-party ad domains.
spoofPageVisibility true Prevents Twitch pausing playback in background tabs.
yieldToOtherBlockers true Stand down if another Twitch ad blocking script is already active.
latencyCorrection true Resync to the live edge when latency drifts.
latencyThreshold 15 Latency (s) tolerated in standard mode.
latencyThresholdLowLatency 5 Latency (s) tolerated in low-latency mode.
latencyCheckInterval 30000 How often (ms) latency is checked.
latencyCooldown 30000 Minimum gap (ms) between corrections.
logLevel 'info' One of debug, info, ok, warn, error, silent.

Requirements

  • Tampermonkey, Violentmonkey, or another userscript manager.
  • Firefox, or a Chromium browser that still supports the required injection (Brave, Edge, Opera). Chrome's Manifest V3 restrictions affect extension-based blockers more than userscripts, but behaviour can vary by version.

The metadata block uses @grant none and @run-at document-start. Both matter: the script must run in page context and must install its Worker override before Twitch instantiates its player. Do not change them.

Known limitations

  • Squad streams are not supported. They use multiple concurrent stream sources and there is no reliable substitution.
  • VODs and clips are out of scope. This targets live playback.
  • Mobile web (m.twitch.tv) is not supported.
  • Twitch Turbo, channel subscriptions, and Prime remove ads at the source with no possibility of breakage. If you watch a small number of channels regularly, subscribing supports them directly and is more reliable than any script.

Troubleshooting

Set logLevel: 'debug' first. Most of the answers below are visible in the console.

Ads are back. Twitch periodically closes the player-type loopholes. Try reordering or extending playerTypes — embed, site, autoplay, thunderdome, and frontpage have all worked at different times. Repeated WARN lines about failed token requests point at the GraphQL side; no warnings but ads still playing points at the player types themselves.

The script logged that it disabled itself. An ERROR line naming the failure means five consecutive interception errors. Reload the page to reset. If it recurs immediately, the technique has been patched and the script needs updating — the error text is the useful part of a bug report.

Nothing is logged at all. The worker hook did not install. Most likely another Twitch ad blocker is running and this one stood down — check for the WARN about the version marker. Do not run two at once.

The stream drifts behind live. Latency correction should handle this. If it is too aggressive or not aggressive enough, adjust latencyThreshold and latencyThresholdLowLatency. Set latencyCorrection: false to disable it.

Playback works but quality dropped. The substitute stream may not offer an identical encoding ladder. The script matches resolution and frame rate where possible and falls back to the closest available.

On ad impression reporting

Some tools in this space report ads as viewed after blocking them, by sending synthetic impression and quartile-completion events. This script does not, and will not. Blocking an ad is one thing; falsifying the telemetry that advertisers are billed against is another.

A note on reliability

This is an arms race, and the script is on the losing side of it by design. Twitch can change its ad delivery server-side, with no deployment on your end, and break every tool of this kind simultaneously. Expect periods where ads play normally until the technique is updated. Nothing here is permanent.

Credits

The stream-substitution approach — worker fetch hooking, iOS platform tokens, player-type escalation, and credential forwarding — is derived from pixeltris/TwitchAdSolutions, which remains the reference implementation and the place to check when this stops working.

License

MIT.

Рейтинг: 0