Created
December 24, 2022 21:25
-
-
Save kitsune7/0fdd840edc76b5a8e8864400df12d9f9 to your computer and use it in GitHub Desktop.
Block Youtube 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 Block Youtube Ads | |
// @namespace https://stay.app/ | |
// @version 0.1 | |
// @description Skip Youtube ads automatically | |
// @author Christopher Bradshaw | |
// @match https://*youtube.com/* | |
// @require https://gist.githubusercontent.com/kitsune7/cd317ed0bda4e96b81febaf11b188d6d/raw/685a67ba681e9914a7e1a3ca52b7d4fc42077c39/monkey-utils.js | |
// @grant none | |
// ==/UserScript== | |
(function () { | |
'use strict'; | |
setReadyHandler('.ytp-ad-text', skipVideo); | |
})(); | |
function skipVideo() { | |
const video = document.querySelector('.video-stream.html5-main-video'); | |
video.play(); | |
video.pause(); | |
video.currentTime = video.duration; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment