A simple method of bypassing YouTube's AdBlock Detection using Enhancer for YouTube's "Remove Ads" button. Does not require the use of any external website like similar tools do :)
当前为
// ==UserScript==
// @name YouTube Anti-AdBlock Bypass via YouTube Enhancer
// @namespace https://e-z.bio/yaw
// @icon https://www.gstatic.com/youtube/img/branding/favicon/favicon_192x192.png
// @version 1.3.1
// @description A simple method of bypassing YouTube's AdBlock Detection using Enhancer for YouTube's "Remove Ads" button. Does not require the use of any external website like similar tools do :)
// @author Yaw
// @match https://www.youtube.com/*
// @run-at document-start
// @license MIT
// @grant none
// ==/UserScript==
(function() {
'use strict';
var searchInterval = 800
var failCounter = 0
var masterSwitch = true
function removeAds() {
const currentURL = window.location.href;
if (masterSwitch) {
if (/https:\/\/www\.youtube\.com\/watch\?.*/.test(currentURL)) { // match url pattern - credits: Zion
const button = document.getElementById("efyt-not-interested");
const adShowing = [...document.querySelectorAll('.ad-showing')][0];
if (adShowing) {
if (button) {
button.click();
console.log("Button found and clicked.")
failCounter = 0
}
else {
console.log("Failed to find button. Retrying in ", searchInterval, " ms")
failCounter = failCounter + 1
}
if (failCounter > 10) {
var buttonNotFound = window.confirm("Failed to find the button more than 10 times. Please make sure that Enhancer for YouTube is installed.\n\nPress 'OK' to redirect to the installation page.\nPress 'Cancel' to disable the Bypasser for this session.");
if (buttonNotFound) {
window.open("https://chrome.google.com/webstore/detail/enhancer-for-youtube/ponfpcnoihfmfllpaingbgckeeldkhle");
failCounter = 0
} else {
masterSwitch = false
}
}
}
}
}
}
setInterval(removeAds, searchInterval);
})();