Created
February 14, 2022 14:39
-
-
Save leo-pfeiffer/6a40717fc6f98614f9b5dbaada483347 to your computer and use it in GitHub Desktop.
YouTube Ad Skipper Script for Tampermonkey
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 Ad Skipper | |
// @namespace https://github.com/leo-pfeiffer | |
// @version 0.1 | |
// @description Skip ads on youtube | |
// @match *://www.youtube.com/* | |
// ==/UserScript== | |
(function() { | |
let checkInterval; | |
let resetInterval = function() { | |
if (checkInterval) { | |
clearTimeout(checkInterval); | |
checkInterval = setTimeout(skip, 500); | |
} | |
checkInterval = setTimeout(skip, 500) | |
} | |
let skip = function() { | |
let btn = document.querySelector(".ytp-ad-skip-button.ytp-button") || | |
document.querySelector(".videoAdUiSkipButton"); | |
if (btn) { | |
btn.click(); | |
resetInterval(); | |
} | |
else { | |
resetInterval(); | |
} | |
} | |
skip(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment