Skip to content

Refactor Auto Skip YouTube Ads to use native skip behavior - #17

Open
senatov wants to merge 7 commits into
tientq64:mainfrom
senatov:auto-skip-native-button
Open

senatov wants to merge 7 commits into
tientq64:mainfrom
senatov:auto-skip-native-button

Conversation

@senatov

@senatov senatov commented Jul 23, 2026

Copy link
Copy Markdown

Uses YouTube’s native Skip button, tracks actual ad playback time, removes forced playback and DOM ad removal, reduces observer overhead, and resets state during navigation.

@tientq64

Copy link
Copy Markdown
Owner

Thanks for the PR. I see that this approach tries to skip YouTube ads by automatically clicking the "Skip Ad" button.

However, I have tried this approach in previous versions, and it no longer works. I also tested your code, but it still wasnt able to click the "Skip Ad" button.

Let YouTube ads begin playing normally and wait for a two-second grace
period before attempting to skip them.

Reveal YouTube's existing native skip control by removing its DOM-level
hidden and disabled states, then invoke the button's own click handler.
This avoids seeking through the ad or directly modifying video playback.

Retry the skip action every 250 ms while the advertisement remains active,
because YouTube may ignore early clicks until the player internally marks
the ad as skippable.

Replace the one-shot skip flag with a timestamp-based retry throttle so a
failed early attempt does not prevent subsequent attempts.

Increase the fallback polling frequency to make the skip response immediate
when the button becomes usable.

Update the userscript metadata and runtime marker from version 8.3.0 to
8.4.0, and keep the generated JavaScript synchronized with the TypeScript
source.
Scope ad markers and skip controls to the active player, require fallback markers to be rendered, and log only the first native skip attempt. This prevents persistent hidden YouTube nodes from producing false ad state while preserving Safari duplicate-injection protection and playback-safe skipping. Refresh the generated userscript and README for version 8.5.0.
Reduce the playback grace period from two seconds to 1.75 seconds so the userscript emulates the native Skip action within the requested 1.5–2 second window. Keep 250 ms retries for controls that YouTube exposes before they become effective, preserve playback-based timing, and update the generated script and changelog to version 8.5.1.
Restrict Skip targeting to actual HTML button elements so YouTube's non-interactive wrapper can no longer consume repeated synthetic clicks. Invoke the native button prototype after the 1.75-second playback threshold and add one diagnostic record with the selected tag, class, and accessible label to make Safari runtime behavior verifiable. Update source, generated userscript, documentation, and version metadata to 8.6.0.
Rename the first Skip diagnostic from a success claim to an attempt and verify the player state one second later. This distinguishes ads that actually end from programmatic clicks that YouTube ignores in Safari, while preserving the playback-safe retry behavior.

Bump the userscript to 8.6.1 and document the new outcome diagnostics.
@senatov

senatov commented Sep 19, 2026

Copy link
Copy Markdown
Author

version 8.6.1 - I’m very sorry, but unfortunately, I’ve taken the plugin and this script as far as they can go in version 8.6.1. At the moment, the “Skip” button in youtube ads is protected by the browser’s and OS security policies.
To click it automatically, the script would need to invoke an external application with the necessary permissions.

Naturally, users would be suspicious of some strange standalone invisible application—different for each operating system—that appears to perform unclear actions. I would be suspicious of such an application myself. 🎃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants