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.3
  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 masterSwitch = true
  19.  
  20. function removeAds() {
  21. const currentURL = window.location.href;
  22. if (masterSwitch) {
  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 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.");
  38. if (buttonNotFound) {
  39. window.open("https://chrome.google.com/webstore/detail/enhancer-for-youtube/ponfpcnoihfmfllpaingbgckeeldkhle");
  40. failCounter = 0
  41. } else {
  42. masterSwitch = false
  43. }
  44. }
  45. }
  46. }
  47. }
  48. }
  49.  
  50. setInterval(removeAds, searchInterval);
  51. })();