Skip to content

Instantly share code, notes, and snippets.

@kitsune7
Created December 24, 2022 21:25
Show Gist options
  • Save kitsune7/0fdd840edc76b5a8e8864400df12d9f9 to your computer and use it in GitHub Desktop.
Save kitsune7/0fdd840edc76b5a8e8864400df12d9f9 to your computer and use it in GitHub Desktop.
Block Youtube ads
// ==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