Skip to content

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YT AutoSkip

A small, fast Chrome/Firefox extension that clicks YouTube's Skip Ad button the instant it becomes clickable, and fast-forwards through ads that don't offer a skip option at all.

Popup screenshot

Why this exists

YouTube's native skip button has a few seconds of forced wait before it's clickable, and on slower connections it's easy to miss the moment it appears. This extension watches the player DOM continuously (via MutationObserver + a fast polling fallback) and clicks the button the moment it's visible — no more staring at the corner of the video waiting to click.

Features

  • Instant skip detection — reacts to DOM mutations rather than polling alone, so there's effectively no delay between the button appearing and being clicked.
  • Unskippable-ad fast-forward — if an ad has no skip button, the extension seeks the video element to the end instead of forcing you to wait it out (mutes audio during the seek so you don't get a blast of ad sound).
  • Stats — tracks ads skipped and estimated time saved, shown in the popup.
  • Resilient selector config — the list of CSS selectors used to find the skip button lives in a small JSON file, not hardcoded in the script. YouTube periodically renames these classes to break ad-blockers; when that happens you only need to update the JSON, not the extension logic.
  • Optional remote config — point the extension at a JSON URL you control (e.g. a raw GitHub Gist) and it'll periodically refresh its selector list from there, so you can patch breakage without shipping a new extension version. Falls back to the last-known-good config (or the bundled defaults) if the URL is unreachable.
  • Cross-browser — single codebase, separate manifests for Chrome and Firefox (Manifest V3 on both).

Install (unpacked, for development/personal use)

This extension is not published to the Chrome Web Store or Firefox Add-ons (see Notes on YouTube's Terms of Service below for why). To use it, load it unpacked:

Chrome / Edge / Brave

  1. Run ./build.sh (or manually copy manifest.chrome.jsonmanifest.json alongside src/ and icons/).
  2. Go to chrome://extensions.
  3. Enable Developer mode (top right).
  4. Click Load unpacked and select the dist/chrome-unpacked folder.

Firefox

  1. Run ./build.sh.
  2. Go to about:debugging#/runtime/this-firefox.
  3. Click Load Temporary Add-on… and select dist/firefox-unpacked/manifest.json.
  4. Note: temporary add-ons are removed when Firefox restarts. For a persistent install you'd need to sign the extension via Mozilla's add-on developer hub.

How it works

src/
├── content.js          # injected into youtube.com — detects & clicks skip button
├── background.js       # service worker — caches/refreshes selector config, badge updates
├── selectors.json       # bundled default selector list
├── browser-polyfill.js  # small shim so chrome.* works the same on Firefox's browser.*
├── popup.html/css/js    # toolbar popup: toggle, stats, remote config input

content.js polls every 250ms and also listens for DOM mutations (ad UI changes trigger a lot of these), so detection happens essentially the moment the button is in the DOM and visible. When a skip button is found, it's clicked immediately. When no skip button exists but an ad is playing, the <video> element's currentTime is seeked to its duration to jump past it.

Selectors are stored as data (selectors.json), not hardcoded into the script logic, specifically so a YouTube class-name change is a one-line fix rather than a rewrite.

Updating selectors when YouTube breaks something

YouTube periodically changes the class names used for the skip button to defeat extensions like this one. When that happens:

  1. Open YouTube while an ad is playing, inspect the skip button, and find its current selector.
  2. Add it to src/selectors.json under skipButtonSelectors.
  3. Reload the unpacked extension.

If you'd rather not rebuild/reload every time, set a remote config URL in the popup (e.g. a raw GitHub Gist URL serving the same JSON shape) — the background worker refreshes from it every 6 hours, and you can trigger an immediate refresh by re-saving the URL in the popup.

A note on YouTube's Terms of Service

Auto-skipping ads via DOM interaction is not a DRM/encryption bypass and isn't illegal for personal use, but it does go against YouTube's Terms of Service, which prohibit interfering with ad delivery. That means:

  • YouTube may detect and degrade playback for extensions like this one without notice.
  • This project is intended for personal, educational use — understanding how content scripts, MutationObservers, and MV3 service workers work together — not for redistribution as a polished consumer product.
  • It is not published on the Chrome Web Store or Firefox Add-ons, by design.

If you want a fully sanctioned way to skip ads, YouTube Premium is the straightforward option. If you want broader ad-blocking with more engineering resources behind maintaining it against YouTube's countermeasures, a browser like Brave or Firefox + uBlock Origin will be more durable than any single unpacked extension.

About

Auto-skips YouTube ads on appearance. MV3, Chrome + Firefox, with stats popup and remote-config support.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages