First, go to the Google Chrome Web Store or another source to obtain the Tampermonkey extension and install it on your browser.
Then, click on "Add new script" to select it.
This will redirect you to the editor, where you should directly copy and paste the following code to replace the demo script code.
// ==UserScript==
// @name Skip YouTube Ads Automatically
// @namespace youtube
// @version 1.0
// @description Automatically skip ads on YouTube webpages
// @author Joey Gambler
// @match *://www.youtube.com/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
function skipAd() {
var skipButton = document.querySelector('.ytp-ad-text.ytp-ad-skip-button-text');
if (skipButton) {
skipButton.click();
console.log("Click button");
}
}
// Set detection interval
var timer = setInterval(skipAd, 1000); // 1000 milliseconds = 1 second
})();
Click on "Editor", then "File", and finally "Save". After refreshing YouTube, you will notice that 5-second countdown ads will be automatically skipped. This method can avoid YouTube detection and replaces manual clicking to skip ads, without having to wait for 5 seconds. It may not work for other types of ads.