Created
February 3, 2026 20:35
-
-
Save sacgov/810d82b88d34379ec23dff66680ad344 to your computer and use it in GitHub Desktop.
Skip youtube first 20 seconds of every video
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
| // ==UserScript== | |
| // @name YouTube - Skip 20 Seconds at Start | |
| // @namespace http://tampermonkey.net/ | |
| // @version 1.0 | |
| // @description Automatically skips the first 20 seconds of any YouTube video | |
| // @author You | |
| // @match https://www.youtube.com/* | |
| // @grant none | |
| // @run-at document-start | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| let skipped = false; | |
| let interval; | |
| const SECONDS = 20; | |
| function skipIntro() { | |
| // const video = document.querySelector('video.html5-main-video'); | |
| const video = document.querySelector("video"); | |
| console.log(video); | |
| const moviePlayer = document.getElementById('movie_player'); | |
| // Check if video is loaded, not an ad, and not already skipped | |
| if (video && moviePlayer && !skipped) { | |
| // Check if the video is actually playing and not just a buffer | |
| video.currentTime = SECONDS; | |
| skipped = true; | |
| console.log(`Skipped ${SECONDS} seconds of YouTube intro.`); | |
| clearInterval(interval); | |
| } | |
| } | |
| // Reset skip status on new video navigation | |
| window.addEventListener('yt-navigate-finish', () => { | |
| skipped = false; | |
| interval = setInterval(skipIntro, 50); | |
| }); | |
| // Check frequently in case of slow loading | |
| interval = setInterval(skipIntro, 50); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment