YouTube Anti-AdBlock Bypass via YouTube Enhancer

A simple method of bypassing YouTube's AdBlock Detection using YouTube Enhancer's "Remove Ads" button. Does not require the use of any external website like similar tools do :)

当前为 2023-10-21 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name YouTube Anti-AdBlock Bypass via YouTube Enhancer
  3. // @namespace https://e-z.bio/yaw
  4. // @version 1.2
  5. // @description A simple method of bypassing YouTube's AdBlock Detection using YouTube Enhancer's "Remove Ads" button. Does not require the use of any external website like similar tools do :)
  6. // @author Yaw
  7. // @match https://www.youtube.com/*
  8. // @run-at document-start
  9. // @license MIT
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. var searchInterval = 800
  17. var failCounter = 0
  18. var toggleSwitch = true
  19.  
  20. function checkForButton() {
  21. const currentURL = window.location.href;
  22. if (toggleSwitch) {
  23. if (/https:\/\/www\.youtube\.com\/watch\?.*/.test(currentURL)) { // match url pattern - credits: Zion
  24. const button = document.getElementById("efyt-not-interested");
  25. const adShowing = [...document.querySelectorAll('.ad-showing')][0];
  26. if (adShowing) {
  27. if (button) {
  28. button.click();
  29. console.log("Button found and clicked.")
  30. failCounter = 0
  31. }
  32. else {
  33. console.log("Failed to find button. Retrying in ", searchInterval, " ms")
  34. failCounter = failCounter + 1
  35. }
  36. if (failCounter > 10) {
  37. var uresponse = window.confirm("Failed to find the button more than 10 times. Please make sure that YouTube Enhancer is installed.\n\nPressing 'OK' will take you to the installation page.\nPressing 'Cancel' will disable the Bypasser for this session.");
  38. if (uresponse) {
  39. window.open("https://chrome.google.com/webstore/detail/enhancer-for-youtube/ponfpcnoihfmfllpaingbgckeeldkhle");
  40. failCounter = 0
  41. } else {
  42. toggleSwitch = false
  43. }
  44. }
  45. }
  46. }
  47. }
  48. }
  49.  
  50. setInterval(checkForButton, searchInterval);
  51. })();