Greasy Fork镜像 支持简体中文。

Ultimate YouTube Ad Remover and Detection Bypasser

Remove YouTube Ads, Bypass Detection, and Block Music Playback Ads

  1. // ==UserScript==
  2. // @name Ultimate YouTube Ad Remover and Detection Bypasser
  3. // @namespace http://tampermonkey.net/
  4. // @version 3.0
  5. // @description Remove YouTube Ads, Bypass Detection, and Block Music Playback Ads
  6. // @author Your Name
  7. // @match https://www.youtube.com/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. let adsBlocked = 0;
  16.  
  17. // Function to remove ads
  18. const removeAds = () => {
  19. const adOverlays = document.querySelectorAll('.ytp-ad-overlay-close-button');
  20. adOverlays.forEach(ad => {
  21. ad.click();
  22. adsBlocked++;
  23. });
  24.  
  25. const videoAds = document.querySelectorAll('.video-ads');
  26. videoAds.forEach(ad => {
  27. ad.remove();
  28. adsBlocked++;
  29. });
  30.  
  31. const adTexts = document.querySelectorAll('.ytp-ad-text');
  32. adTexts.forEach(ad => {
  33. ad.remove();
  34. adsBlocked++;
  35. });
  36. };
  37.  
  38. // Monitor for new elements added to the DOM
  39. const observer = new MutationObserver(mutations => {
  40. mutations.forEach(mutation => {
  41. mutation.addedNodes.forEach(node => {
  42. if (node.nodeType === Node.ELEMENT_NODE) {
  43. if (node.classList.contains('ytp-ad-overlay') || node.classList.contains('video-ads') || node.classList.contains('ytp-ad-text')) {
  44. removeAds();
  45. }
  46. }
  47. });
  48. });
  49. });
  50.  
  51. // Start observing the document
  52. observer.observe(document.body, { childList: true, subtree: true, attributes: false, characterData: false });
  53.  
  54. // Event listener to remove context menu, keyboard/mouse events on video load
  55. window.addEventListener('load', () => {
  56. const player = document.querySelector('.html5-main-video');
  57. if (player) {
  58. player.oncontextmenu = null;
  59. player.onkeydown = null;
  60. player.onmousedown = null;
  61. player.onselectstart = null;
  62. }
  63. });
  64.  
  65. // Button to show the number of ads blocked
  66. const adBlockedButton = document.createElement('button');
  67. adBlockedButton.innerHTML = 'Ads Blocked';
  68. adBlockedButton.style.position = 'fixed';
  69. adBlockedButton.style.bottom = '20px';
  70. adBlockedButton.style.left = '20px';
  71. adBlockedButton.style.zIndex = '9999';
  72. adBlockedButton.onclick = () => alert(`Total Ads Blocked: ${adsBlocked}`);
  73. document.body.appendChild(adBlockedButton);
  74. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址