您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automatically closes the banner ad or clicks the "Skip ad" button and likes video if you subscribe to the channel.
当前为
// ==UserScript== // @name YAAS (YouTube Ads Auto Skip) // @description Automatically closes the banner ad or clicks the "Skip ad" button and likes video if you subscribe to the channel. // @name:uk YAAS (Автоматичний пропуск реклами на YouTube) // @description:uk Автоматично закриває рекламний банер чи клікає по кнопці "Пропустити рекламу" та ставить лайк, якщо є підписка на канал. // @version 2.2.1 // @namespace https://gf.qytechs.cn/uk/users/741855 // @author boboha // @match https://www.youtube.com/* // ==/UserScript== (function() { 'use strict'; let like = false; const SEC = 1000, TO = 0 * SEC, TO_SUBSCIBED = 45 * SEC, log = (msg) => {console.log('[YAAS]', msg);}, isSubscribed = () => document.querySelector('#subscribe-button [subscribed]') ? true : false, isLiked = () => document.querySelector('#info #menu ytd-toggle-button-renderer').className.endsWith('style-default-active') ? true : false, getTimeout = () => (isSubscribed() || isLiked()) ? TO_SUBSCIBED : TO, checkLike = () => { if (isSubscribed() && !isLiked()) { document.querySelector('#info #menu ytd-toggle-button-renderer').click(); like = true; log('👍 Ok!'); } }, skipVideo = (btn) => { setTimeout(() => { skip(btn); }, getTimeout()); }, skip = (btn) => { if (btn.nodeType === 1 && getComputedStyle(btn).display === 'inline-block') { btn.click(); log('Video skiped!'); } else { setTimeout(() => { skip(btn); }, 100); } }, closeBaner = (btn) => { setTimeout(() => { btn.click(); log('Baner closed!'); }, getTimeout()); }, observer = new MutationObserver(mutations => { if (location.pathname == '/watch') { !like && checkLike(); for (const mutation of mutations) { try { if (mutation.target.className === 'video-ads ytp-ad-module' && mutation.addedNodes.length) { // Video loading if (mutation.addedNodes[0].className === 'ytp-ad-player-overlay') { log('Video loaded...'); } // Baner loading else if (mutation.addedNodes[0].className === 'ytp-ad-overlay-slot') { log('Baner loaded...'); // Baner closing const close_button = mutation.addedNodes[0].querySelector('.ytp-ad-overlay-close-container > .ytp-ad-overlay-close-button'); close_button && closeBaner(close_button); } } // Video skiping if (mutation.target.className === 'ytp-ad-skip-button-slot') { const skip_button = mutation.target.querySelector('.ytp-ad-skip-button-container > .ytp-ad-skip-button'); skip_button && skipVideo(skip_button); } } catch (e) { console.groupCollapsed(e.message, mutation.target); console.log(mutation); console.groupEnd(); } } } }), init = () => { const player = document.querySelector('#movie_player'); if (player) { observer.observe(player, {childList: true, attributes: true, subtree: true}); log('Init'); } else { setTimeout(init, 100); } } init(); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址