Files
stuff/yt-no-ads.js

32 lines
938 B
JavaScript
Raw Normal View History

2026-04-17 11:39:29 +02:00
// ==UserScript==
// @name Auto Skip YouTube Ads
// @version 1.0.0
// @description Speed up and skip YouTube ads automatically
// @author jso8910
// @match *://*.youtube.com/*
// @exclude *://*.youtube.com/subscribe_embed?*
// ==/UserScript==
// Does not work 2025-10-05T20:16
// <button class="ytp-skip-ad-button" id="skip-button:c" style="opacity: 0.5;">flex
const clickAdButton = () => {
const btn = document.querySelector('.videoAdUiSkipButton,.ytp-ad-skip-button,.ytp-skip-ad-button');
if (btn) {
btn.click();
console.log("Clicked the skip button")
}
};
const speedUpAd = () => {
const ad = [...document.querySelectorAll('.ad-showing')][0];
if (ad) {
document.querySelector('video').playbackRate = 10;
console.log("Speed up ad!!");
setTimeout(clickAdButton, 500);
// setInterval(clickAdButton, 2000);
}
}
// Run every 200ms
setInterval(speedUpAd, 200);