Repository navigation
Conversation
…-skip - Inject MAIN-world script that strips playerAds/adPlacements from /youtubei/v1/player and /next responses so the player never tries to load ads (fastest path). - Auto-skip fallback in content.js: clicks Skip button, fast-forwards non-skippable ads via currentTime=duration, with per-src guard and loadstart suspension to prevent skipping the real video. - Mute applied immediately when ad-showing is detected (no audio leak). - CSS hides ad overlays and the video element while ads play. - New DNR rules for YouTube ad endpoints (pagead, ptracking, stats/ads, doubleclick subdomains). - Counter increments per skipped YouTube ad.
Owner
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds first-class YouTube ad blocking on top of the existing network/cosmetic filtering. Three layers, ordered by speed:
youtube-inject.js(new) — runs inworld: "MAIN"atdocument_start. Wrapswindow.fetchandXMLHttpRequestto intercept/youtubei/v1/player,/next, and/reel/reel_watch_sequenceresponses, recursively strippingplayerAds,adPlacements,adSlots,adBreakHeartbeatParams. The player never tries to load an ad → instant video start.content.js— auto-skip fallback. Clicks the Skip button, fast-forwards non-skippable ads (currentTime = duration), mutes the momentad-showingis detected. Per-source guard + 150msloadstartsuspension prevent the bug where the real video gets sent to the end. State (muted/playbackRate) is reset on every media swap.content.css— hides ad overlays / display ads / promo cards whilead-showingis set.Also adds 5 DNR rules for YouTube-specific ad endpoints (
/api/stats/ads,/pagead/,/ptracking,googleads.g.doubleclick.net,static.doubleclick.net).The skip counter increments by one per skipped ad (guarded against double-counting via
skippedSrc).Test plan
chrome://extensionsenabled = false) re-enables ads as expectedytd-display-ad-renderer,#masthead-ad, etc.)youtube-nocookie.comembeds