您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Bloqueador avançado de anúncios para YouTube e YouTube Music
当前为
// ==UserScript== // @name Bloqueador de Anúncios para YouTube/YouTube Music // @namespace http://tampermonkey.net/ // @version 2.6 // @description Bloqueador avançado de anúncios para YouTube e YouTube Music // @author _PeDeCoca // @match *://*.youtube.com/* // @match *://*.youtube-nocookie.com/* // @match *://*.music.youtube.com/* // @grant GM_addStyle // @grant unsafeWindow // @grant GM_xmlhttpRequest // @run-at document-start // @license @Mit // ==/UserScript== (function() { 'use strict'; // Estilos do ícone com emoji const iconStyles = ` #adblock-indicator { position: fixed; top: 10px; right: 10px; width: 40px; height: 40px; cursor: pointer; z-index: 9999999; display: flex; align-items: center; justify-content: center; font-size: 25px; background: white; border-radius: 50%; transition: all 0.3s ease; } #adblock-indicator::before { content: '🛡️'; position: relative; z-index: 2; } #adblock-indicator::after { content: ''; position: absolute; inset: -3px; background: conic-gradient( from 0deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000 ); border-radius: 50%; z-index: 0; animation: rotate 3s linear infinite, glow 2s ease-in-out infinite alternate; opacity: 0.8; } #adblock-indicator:hover { transform: scale(1.1); } #adblock-indicator:hover::after { animation: rotate 1s linear infinite, glow 1s ease-in-out infinite alternate; opacity: 1; } @keyframes rotate { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } @keyframes glow { 0% { filter: hue-rotate(0deg) brightness(1) blur(2px); transform: rotate(0deg) scale(1); } 100% { filter: hue-rotate(360deg) brightness(1.2) blur(3px); transform: rotate(360deg) scale(1.05); } } `; // Estilos para bloqueio agressivo de anúncios const aggressiveAdStyles = ` .video-ads, .ytp-ad-overlay-slot, #masthead-ad, #player-ads, ytd-promoted-video-renderer, .ytd-promoted-sparkles-web-renderer, .ytd-display-ad-renderer, .ytd-in-feed-ad-layout-renderer, ytd-compact-promoted-video-renderer, .ytd-promoted-video-descriptor-renderer, /* Additional aggressive selectors */ ytd-ad-slot-renderer, ytd-in-feed-ad-layout-renderer, ytd-banner-promo-renderer, ytd-statement-banner-renderer, ytd-video-masthead-ad-advertiser-info-renderer, ytd-engagement-panel-section-list-renderer[target-id="engagement-panel-ads"], .ytd-advertisement-renderer, .ytp-ad-overlay-image, .ytp-ad-text-overlay, #offer-module, #premium-upsell, .ytd-banner-promo-renderer-background, paper-dialog.ytd-popup-container, .ytd-video-quality-promo-renderer, .ytd-mealbar-promo-renderer, #masthead-ad-container, /* Seletores do Google AdSense */ ins.adsbygoogle, .adsbygoogle, iframe[src*="adsbygoogle"], #YtKevlarVisibilityIdentifier, [aria-label*="anúncio"], [id*="google_ads_"], [id*="adcontainer"], [class*="adsbygoogle"], [data-ad-client], [id*="doubleclick"], /* Player específico do YouTube */ .video-ads.ytp-ad-module, .ytp-ad-player-overlay-layout, .ytp-ad-player-overlay-layout__player-card-container, .ytp-ad-player-overlay-layout__ad-info-container, .ytp-ad-player-overlay-layout__skip-or-preview-container, .ytp-ad-player-overlay-layout__ad-disclosure-banner-container, .html5-video-player.ad-created.ad-showing.ad-interrupting, .ytp-ad-skip-button, .ytp-ad-pod-index, .ytp-ad-pod-index--stark, .ytp-ad-persistent-progress-bar-container, .ytp-ad-progress-list, .ytp-ad-progress-bar, [class*="ytp-ad-"], [id*="ad-badge"], [id*="ad-text"], [id*="ad-preview"], [class*="ad-showing"], [class*="ad-interrupting"] { display: none !important; opacity: 0 !important; pointer-events: none !important; width: 0 !important; height: 0 !important; position: fixed !important; top: -1000px !important; left: -1000px !important; } `; // Adiciona ambos os estilos GM_addStyle(iconStyles + aggressiveAdStyles); // Adiciona elemento indicador const addIndicator = () => { const indicator = document.createElement('div'); indicator.id = 'adblock-indicator'; indicator.title = 'AdBlock Ativado - Clique para entrar em contato discord: _PeDeCoca'; indicator.addEventListener('click', () => { window.open('https://discord.com/users/_PeDeCoca', '_blank'); }); document.body.appendChild(indicator); }; // Bloqueador avançado de anúncios const ultraBlocker = { init() { addIndicator(); this.injectAntiAdBlockKiller(); this.setupAggressiveSkipper(); this.hijackXHR(); this.bypassPremiumChecks(); this.setupObserver(); this.blockGoogleAds(); this.setupPlayerObserver(); setInterval(() => { this.superAggressiveRemoval(); this.overrideYTPlayer(); }, 1000); }, setupAggressiveSkipper() { setInterval(() => { const video = document.querySelector('video'); if (video) { // Força o pulo de qualquer conteúdo publicitário if (document.querySelector('.ad-showing')) { video.currentTime = video.duration; video.playbackRate = 16; this.clickSkipBtn(); } // Remove anúncios sobrepostos this.removeAdElements(); } }, 50); }, // Função para clicar no botão de pular clickSkipBtn() { const skipBtns = [ '.ytp-ad-skip-button', '.videoAdUiSkipButton', '.ytp-ad-skip-button-modern' ]; skipBtns.forEach(btn => { const skipButton = document.querySelector(btn); if (skipButton) skipButton.click(); }); }, // Injeta o anti-detector de bloqueador injectAntiAdBlockKiller() { const code = function() { const _toString = Function.toString; Function.prototype.toString = function() { if (this === Function.prototype.toString) return _toString.call(this); if (this.name === 'detect') return 'function detect() { return false; }'; if (this.name === 'isAdBlocker') return 'function isAdBlocker() { return false; }'; return _toString.call(this); }; // Sobrescreve propriedades de detecção de anúncios Object.defineProperties(window, { 'adBlocker': { value: false }, 'google_ad_status': { value: 1 }, 'ytInitialPlayerResponse': { get: function() { return { adPlacements: [], playerAds: [], adSlots: [], videoDetails: { isLiveContent: false } }; } } }); }.toString(); // Usa método de injeção mais seguro const script = document.createElement('script'); script.textContent = `(${code})();`; const container = document.head || document.documentElement; container.addEventListener('load', function() { this.remove(); }, { once: true }); if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => container.appendChild(script)); } else { container.appendChild(script); } }, // Intercepta requisições XHR hijackXHR() { const XHR = XMLHttpRequest.prototype; const open = XHR.open; const send = XHR.send; XHR.open = function(method, url) { if (url.includes('/api/stats/')) { arguments[1] = 'about:blank'; } return open.apply(this, arguments); }; XHR.send = function(data) { if (this.responseType === 'json' && data?.includes('adPlacements')) { return; } return send.apply(this, arguments); }; }, // Bypass nas verificações de conta Premium bypassPremiumChecks() { Object.defineProperty(window, 'ytplayer', { get: () => ({ config: { loaded: true, args: { raw_player_response: { adPlacements: [], videoDetails: { isPrivate: false, isLive: false, isLowLatencyLiveStream: false, isUpcoming: false } } } } }) }); }, // Configura observador de mudanças no DOM setupObserver() { const observer = new MutationObserver(() => { const adSelectors = [ 'ytd-promoted-video-renderer', 'ytd-display-ad-renderer', 'ytd-compact-promoted-video-renderer', '.ytd-promoted-sparkles-web-renderer', 'ins.adsbygoogle', '.adsbygoogle', 'iframe[src*="adsbygoogle"]', '[id*="google_ads_"]', '[data-ad-client]', '[id*="doubleclick"]', '.ytp-ad-overlay-image', '.ytp-ad-text-overlay', '#offer-module', '#premium-upsell', '.ytd-promoted-sparkles-web-renderer' ].join(','); document.querySelectorAll(adSelectors).forEach(ad => ad.remove()); }); observer.observe(document.body, { childList: true, subtree: true }); }, // Novo método para bloquear anúncios do Google blockGoogleAds() { // Bloqueia scripts do Google Ads const blockPatterns = [ 'googlesyndication.com', 'doubleclick.net', 'google-analytics.com', '/pagead/', 'ad.doubleclick.net' ]; // Remove scripts existentes document.querySelectorAll('script').forEach(script => { if (blockPatterns.some(pattern => script.src.includes(pattern))) { script.remove(); } }); // Previne carregamento de novos scripts const observer = new MutationObserver((mutations) => { mutations.forEach((mutation) => { mutation.addedNodes.forEach((node) => { if (node.tagName === 'SCRIPT' && blockPatterns.some(pattern => node.src?.includes(pattern))) { node.remove(); } }); }); }); observer.observe(document.documentElement, { childList: true, subtree: true }); }, setupPlayerObserver() { // Observer específico para o player const observer = new MutationObserver(() => { // Remove classe de anúncio do player const player = document.querySelector('.html5-video-player'); if (player) { player.classList.remove('ad-showing', 'ad-interrupting', 'ad-created'); } // Força o skip de anúncios const video = document.querySelector('video'); if (video && document.querySelector('[class*="ad-showing"]')) { video.currentTime = video.duration; const skipButton = document.querySelector('.ytp-ad-skip-button'); if (skipButton) skipButton.click(); } // Remove containers de anúncios [ '.ytp-ad-player-overlay-layout', '.ytp-ad-player-overlay-layout__player-card-container', '.ytp-ad-persistent-progress-bar-container', '.video-ads.ytp-ad-module', '[class*="ytp-ad-"]' ].forEach(selector => { document.querySelectorAll(selector).forEach(el => el.remove()); }); }); observer.observe(document.documentElement, { childList: true, subtree: true, attributes: true, attributeFilter: ['class'] }); }, superAggressiveRemoval() { const possibleAdWords = [ 'sponsored', 'ad', 'ads', 'advertisement', 'anúncio' ]; // Remove elementos cujo texto contenha possíveis palavras de anúncio const textNodes = document.querySelectorAll('body *'); textNodes.forEach(node => { const text = node.textContent?.toLowerCase() || ''; if (possibleAdWords.some(adWord => text.includes(adWord))) { node.remove(); } }); }, overrideYTPlayer() { // Força a recriação do objeto player sem anúncios if (typeof window.ytplayer !== 'undefined' && window.ytplayer.config) { window.ytplayer.config.args.raw_player_response.adPlacements = []; window.ytplayer.config.args.raw_player_response.playerAds = []; } } }; // Inicializa o bloqueador avançado if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => ultraBlocker.init()); } else { ultraBlocker.init(); } // Bloqueio avançado de requisições com mais padrões const originalFetch = unsafeWindow.fetch; unsafeWindow.fetch = async function(...args) { const url = args[0]?.url || args[0]; if (typeof url === 'string' && ( url.includes('doubleclick.net') || url.includes('googlesyndication.com') || url.includes('/pagead/') || url.includes('google-analytics.com') || url.includes('youtube.com/api/stats/ads') || url.includes('youtube.com/pagead/') || url.includes('youtube.com/get_midroll_') || url.includes('youtube.com/ptracking') || url.includes('youtube.com/annotations_invideo') || url.includes('youtube.com/api/stats/watchtime') || url.includes('ad.doubleclick.net') || url.includes('googleadservices.com') || url.includes('adsystem.com') || url.includes('analytics') || url.includes('pagead') || url.includes('measured') || url.includes('tracking') || url.includes('stats') || url.includes('atr') )) { return new Response(JSON.stringify({ playerResponse: { adPlacements: [], playbackTracking: {}, videoDetails: { isLiveContent: false } } })); } return originalFetch.apply(this, args); }; })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址