TwitchAdSolutions

repository·master·Indexed 10 days ago

https://github.com/pixeltris/twitchadsolutions

A collection of methods for blocking ads on Twitch, featuring the recommended vaft and video-swap-new scripts. Supports implementation via uBlock Origin filters, userscript managers (Violentmonkey, Tampermonkey), and provides a comprehensive guide to third-party extensions and applications like TTV LOL PRO, Alternate Player for Twitch, and Xtra for Twitch.

Tokens
2.2K
Snippets
4
Records
12
Agent score
95%

What's inside TwitchAdSolutions

  1. Choose a Twitch ad-blocking solution

    master

    There are several ways to handle Twitch ads depending on your platform and preferred method:

    Official Solution

    • Twitch Turbo: A paid subscription ($11.99/Month) that provides an ad-free experience natively without third-party tools. This is the only solution that contributes to Twitch's ecosystem.

    Web Browser Extensions

    • TTV LOL PRO: A highly improved fork of TTV LOL. Recommended to be used with uBlock Origin. Note that it is incompatible with proxies designed for the original TTV LOL.
    • Alternate Player for Twitch: Removes ad segments (playback stops until the ad-free stream is found) or uses low resolution during midrolls.
    • Purple AdBlock: Replaces ad segments with ad-free segments using proxy fallback. If both fail, it removes ad segments (no playback until ad-free stream is found).
    • AdGuard Extra: Attempts to fetch a high-resolution clean stream as quickly as possible.
    • TTV Ad Mute: Mutes/unmutes tabs and covers the ad player with a black box. Muting the browser tab avoids negatively impacting streamer metrics and prevents Twitch Drops from being disabled.

    Userscripts

    • vaft: (Recommended) Attempts to get a clean stream quickly; if it fails, it removes ad segments.
    • Twitch Mute Ads: Mutes ads and can optionally hide them via script settings.

    Third-Party Applications & Mobile

    • Streamlink: Removes ad segments. For uninterrupted playback, use a modified file from this source.
    • Xtra for Twitch (Android): An alternate player. Because TTV LOL no longer works, you must enter a custom proxy URL in settings (e.g., https://eu.luminous.dev/live/$channel?allow_source=true&allow_audio_only=true&fast_bread=true) to enable ad-blocking.
    • ReVanced (Android): A patching tool that can use TTV LOL or PurpleAdBlocker proxies. Setup is complex; Xtra is recommended for ease of use.
    • TwitchAdBlock (iOS): Blocks ads on iOS devices.
  2. Apply Twitch ad-blocking scripts via userscript manager

    master

    To use the scripts as userscripts, you must have a userscript manager installed. Viewing the script file directly should prompt your manager to install it.

    Supported Managers:

    • Violentmonkey
    • Tampermonkey
    • Userscripts (iOS)

    Warning: Greasemonkey is not compatible with these scripts.

  3. Enable user script permissions in Chrome (Manifest V3)

    master

    If you are using Chrome with a Manifest V3 userscript manager (like Tampermonkey), you must manually enable user script permissions for the extension to work:

    1. Navigate to chrome://extensions
    2. Click the Details button on the extension
    3. Ensure Allow user scripts is enabled.
    chrome://extensions
  4. Apply Twitch ad-blocking scripts via uBlock Origin

    master

    To use the provided scripts with uBlock Origin, follow these steps:

    1. Add the JS filter: Navigate to the uBlock Origin Dashboard, go to the My filters tab, and add the following line: twitch.tv##+js(twitch-videoad)
    2. Configure userResourcesLocation:
      • Go to the Settings tab.
      • Enable I am an advanced user.
      • Click the cog icon that appears.
      • Change the value of userResourcesLocation from unset to the full URL of the script you want to use. If a URL is already present, add a space after it before appending the new one.
    3. Reload: Disable and re-enable the uBlock Origin extension or restart your browser to ensure the script loads.

    To stop using a script: Remove the filter from the My filters tab and set userResourcesLocation back to unset.

    Note: For security, it is recommended to use a permalink URL so that scripts do not auto-update unexpectedly. Also, be aware that scripts may randomly stop being applied by uBlock Origin for unknown reasons; using the userscript version is recommended for better reliability.

    userResourcesLocation https://raw.githubusercontent.com/pixeltris/TwitchAdSolutions/master/vaft/vaft-ublock-origin.js
  5. Configure custom proxy for Xtra for Twitch

    master

    Since the original TTV LOL service no longer works, users of the Xtra for Twitch Android app must manually configure a custom proxy URL in the app settings to enable ad-blocking capabilities.

    https://eu.luminous.dev/live/$channel?allow_source=true&allow_audio_only=true&fast_bread=true
  6. Troubleshoot uBlock Origin script injection

    master
    If the script is not working, verify it is being injected into the page. Open your browser's developer console, refresh the stream, and search for either hookWorkerFetch (vaft) or hookWorkerFetch (video-swap-new). If these strings are not found, the script is not being injected and you must check your uBlock Origin setup against the README instructions.
  7. Fix playback issues in `vaft` (freezing, buffering, desyncs)

    master

    The vaft script can cause playback problems (freezing, buffering, repeating segments, or audio desyncs) because it forces the player to consume multiple m3u8 files.

    Immediate Fix: Pressing pause/play often resolves these issues.

    Configuration Adjustments: To manage how the script handles buffering and player reloads, adjust the following settings in the script configuration:

    • PlayerBufferingDoPlayerReload: Set to true if the script triggers but the player still freezes. Player reloads are generally more stable.
    • PlayerBufferingDelay / PlayerBufferingSameStateCount: Adjust these if the script triggers incorrectly during genuine player buffering.
    • PlayerBufferingMinRepeatDelay: Increase this value if the script triggers too frequently. Decrease it if the script triggers, freezes, and then has to wait too long to re-trigger.
    • PlayerBufferingFix: Set to false if you want to disable the automatic fix and handle buffering manually.
    • AlwaysReloadPlayerOnAd: Set to true to potentially reduce freezing issues when entering an ad.
  8. Troubleshoot proxy issues and buffering

    master

    When using proxy-based ad-blocking solutions, you may encounter the following issues:

    Error 2000 or seeing ads

    This is typically caused by proxy downtime and is not a direct retaliation from Twitch. If this occurs, you may need to wait for the proxy to come back online or switch solutions.

    Buffering at high resolutions

    Buffering happens because traffic is routed through a Twitch server closest to the initial m3u8 proxy request.

    Solutions:

    1. Lower the resolution: Use a lower quality stream to reduce bandwidth requirements.
    2. Use a VPN: A VPN might provide a better routing path.
    3. Contact the maintainer: Ask the proxy maintainer to add a proxy in a country geographically closer to you.
    4. Switch solutions: Use a non-proxy based solution (like vaft or TTV Ad Mute).
  9. Available Twitch ad-blocking scripts

    master

    The repository provides two main script solutions:

    • vaft: Attempts to obtain a clean stream as quickly as possible. If a clean stream cannot be found, it removes ad segments (resulting in no playback until an ad-free stream is located). This is the recommended script.
    • video-swap-new: Similar to vaft, it attempts to get a clean stream or removes ad segments if it fails. This is not recommended as vaft is superior.

    Scripts are available in both userscript and ublock formats.

    # vaft
    - [userscript](https://github.com/pixeltris/TwitchAdSolutions/raw/master/vaft/vaft.user.js)
    - [ublock](https://raw.githubusercontent.com/pixeltris/TwitchAdSolutions/master/vaft/vaft-ublock-origin.js)
    
    # video-swap-new
    - [userscript](https://github.com/pixeltris/TwitchAdSolutions/raw/master/video-swap-new/video-swap-new.user.js)
    - [ublock](https://raw.githubusercontent.com/pixeltris/TwitchAdSolutions/master/video-swap-new/video-swap-new-ublock-origin.js)