您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
检测YouTube广告,自动加速至16倍、静音、提示并自动跳过,适配多种广告类型,提升跳过成功率。
当前为
// ==UserScript== // @name YouTube广告加速跳过增强版 // @namespace http://tampermonkey.net/ // @version 1.1 // @description 检测YouTube广告,自动加速至16倍、静音、提示并自动跳过,适配多种广告类型,提升跳过成功率。 // @author little fool // @match *://www.youtube.com/* // @match *://m.youtube.com/* // @match *://music.youtube.com/* // @match *://www.youtube-nocookie.com/* // @grant none // @run-at document-start // ==/UserScript== (function () { 'use strict'; const SHOW_LOG = false; // 创建提示UI const createNotice = () => { const notice = document.createElement('div'); notice.id = 'ad-skip-notice'; notice.textContent = '⏩ 正在跳过广告...'; notice.style = ` position: fixed; bottom: 30px; right: 30px; background: rgba(0, 0, 0, 0.85); color: #fff; padding: 10px 20px; font-size: 14px; border-radius: 6px; z-index: 999999; display: none; border-left: 5px solid #e74c3c; font-family: sans-serif; `; document.body.appendChild(notice); return notice; }; let noticeEl; const showNotice = () => noticeEl && (noticeEl.style.display = 'block'); const hideNotice = () => noticeEl && (noticeEl.style.display = 'none'); const isAdPlaying = () => { return ( document.querySelector('.ad-showing') || document.querySelector('.ytp-ad-player-overlay') || document.querySelector('.ytp-ad-image') || document.querySelector('.ytp-ad-module') || document.querySelector('div[class*="ad-interrupting"]') ); }; const trySkip = () => { const skipBtn = document.querySelector('.ytp-ad-skip-button, .ytp-ad-skip-button-modern'); if (skipBtn) { skipBtn.click(); SHOW_LOG && console.log('⏩ 点击跳过按钮'); } }; const handleAds = () => { const video = document.querySelector('video'); if (!video) return; if (isAdPlaying()) { showNotice(); video.playbackRate = 16; video.muted = true; trySkip(); } else { hideNotice(); video.playbackRate = 1; video.muted = false; } }; // 启动逻辑(等DOM加载完成) window.addEventListener('DOMContentLoaded', () => { noticeEl = createNotice(); setInterval(() => { handleAds(); }, 500); // 更频繁地检测广告,提高跳过率 SHOW_LOG && console.log('✅ YouTube广告加速跳过脚本已运行'); }); })();