Created
October 20, 2023 11:05
-
-
Save Hazem-Gamall/945ead96d9e06498f413381bc048b360 to your computer and use it in GitHub Desktop.
A Tampermonkey script to skip ads on YouTube since they are blocking ad-blockers and i hate ads
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 http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://www.youtube.com/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Your code here... | |
const f =() => { | |
const btn = document.querySelector('.ytp-ad-skip-button'); | |
const adText = document.querySelector('.ytp-ad-text'); | |
const v = document.querySelector('video'); | |
if(adText){ | |
v.currentTime = v.duration | |
} | |
if(btn){ | |
v.currentTime = v.duration | |
btn.click(); | |
} | |
} | |
setInterval(f, 100); | |
})(); |
Not Working - Need to Update
Updated Version
const f =() => { const btn = document.querySelector('.ytp-skip-ad-button'); const adText = document.querySelector('.ytp-skip-ad-button__text'); const v = document.querySelector('video'); if(adText){ v.currentTime = v.duration } if(btn){ v.currentTime = v.duration btn.click(); } } setInterval(f, 100); })();
Sorry i no longer use or maintain it since i just use uBlock origin now which does a great job blocking youtube ads and ads in general.
It ain't work
@Mohamed7422
Show your codes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🙌🫶