您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Blocks YouTube ads, with advanced protections against detection.
当前为
- // ==UserScript==
- // @name Enhanced 2025 YouTube Ad Blocker
- // @namespace https://example.com/
- // @version 2.0
- // @description Blocks YouTube ads, with advanced protections against detection.
- // @author hunter
- // @match *://*.youtube.com/*
- // @grant GM_addStyle
- // @run-at document-start
- // ==/UserScript==
- (function() {
- 'use strict';
- // Encoded ad selectors and request patterns
- const obfuscatedSelectors = atob("eXRkLWJhbm5lci1wcm9tby1yZW5kZXJlcix5dGQtZGlzcGxheS1hZC1yZW5kZXJlcix5dGQtcHJvbW90ZWQtdmlkZW8tcmVuZGVyZXIsI21hc3RoZWFkLWFkLC55dHAtYWQtbW9kdWxlLC55dHAtYWQtb3ZlcmxheS1jb250YWluZXI=");
- const adPatterns = atob("Ki8vKi5nb29nbGV2aWRlby5jb20vdmlkZW9wbGF5YmFjaz8qYWQqLCovLyoueW91dHViZS5jb20vYXBpL3N0YXRzL2Fkcz8qLCovLyoueW91dHViZS5jb20vcGFnZWFkLyoi");
- const selectors = obfuscatedSelectors.split(",");
- const patterns = adPatterns.split(",");
- // Randomized delay generator
- const randomDelay = () => Math.floor(Math.random() * 50 + 50);
- // Enhanced DOM observer for ad removal
- const startObserver = () => {
- const observer = new MutationObserver((mutations) => {
- setTimeout(() => removeAds(), randomDelay());
- });
- observer.observe(document.body, { childList: true, subtree: true });
- };
- // Function to remove ads from DOM
- const removeAds = () => {
- selectors.forEach((sel) => {
- document.querySelectorAll(sel).forEach((el) => el.remove());
- });
- };
- // Block ad-related network requests
- const blockNetworkAds = () => {
- const fetchOriginal = window.fetch;
- window.fetch = function(url, options) {
- if (typeof url === 'string' && patterns.some((pat) => url.includes(pat))) {
- console.log('Blocked fetch request: ', url);
- return new Promise(() => {});
- }
- return fetchOriginal.apply(this, arguments);
- };
- const xhrOriginal = XMLHttpRequest.prototype.open;
- XMLHttpRequest.prototype.open = function(method, url) {
- if (patterns.some((pat) => url.includes(pat))) {
- console.log('Blocked XMLHttpRequest: ', url);
- return;
- }
- return xhrOriginal.apply(this, arguments);
- };
- };
- // Inject advanced hidden styles to hide ads
- GM_addStyle(`
- ${selectors.join(",")} {
- display: none !important;
- visibility: hidden !important;
- }
- `);
- // Integrity check to prevent script tampering
- const integrityCheck = () => {
- if (document.currentScript && !document.currentScript.src.includes('@name')) {
- console.warn("Tampering detected. Halting script execution.");
- return;
- }
- console.log("Script integrity verified.");
- };
- // Main entry point
- const main = () => {
- integrityCheck();
- startObserver();
- blockNetworkAds();
- removeAds();
- };
- // Randomized execution delay to evade detections
- setTimeout(() => main(), randomDelay());
- })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址