您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Disable YouTube video based ads right before the main video plays
当前为
// ==UserScript== // @name Disable YouTube Video Ads // @namespace DisableYouTubeVideoAds // @description Disable YouTube video based ads right before the main video plays // @version 1.0.2 // @author jcunews // @include https://www.youtube.com/watch* // @grant unsafeWindow // @run-at document-start // ==/UserScript== (function check() { if (unsafeWindow.yt && unsafeWindow.yt.player && unsafeWindow.yt.player.Application && unsafeWindow.yt.player.Application.create && !unsafeWindow.yt.player.Application.dyva) { unsafeWindow.yt.player.Application.dyva = 1; var ytPlayerApplicationCreate = unsafeWindow.yt.player.Application.create; unsafeWindow.yt.player.Application.create = function(id, ytPlayerConfig){ if ((id === "player-api") && ytPlayerConfig && ytPlayerConfig.args && ytPlayerConfig.args.vmap) { delete ytPlayerConfig.args.vmap; } return ytPlayerApplicationCreate.apply(this, arguments); }; var ytSetConfig = unsafeWindow.yt.setConfig; unsafeWindow.yt.setConfig = function(ytConfig){ if (ytConfig) { if (ytConfig.ADS_DATA) { delete ytConfig.ADS_DATA; } } return ytSetConfig.apply(this, arguments); }; var ytcfgSet = unsafeWindow.ytcfg.set; unsafeWindow.ytcfg.set = function(ytConfig){ if (ytConfig) { if (ytConfig.SKIP_RELATED_ADS === false) { ytConfig.SKIP_RELATED_ADS = true; } if (ytConfig.TIMING_ACTION) { ytConfig.TIMING_ACTION = ytConfig.TIMING_ACTION.replace(/watch7ad/, "watch7"); } if (ytConfig.TIMING_INFO) { if (ytConfig.TIMING_INFO.yt_ad) { ytConfig.TIMING_INFO.yt_ad = 0; } if (ytConfig.TIMING_INFO.yt_ad_an) { delete ytConfig.TIMING_INFO.yt_ad_an; } if (ytConfig.TIMING_INFO.yt_ad_pr) { ytConfig.TIMING_INFO.yt_ad_pr = 0; } } } return ytcfgSet.apply(this, arguments); }; } else setTimeout(check, 20); })(); addEventListener("spfpartprocess", function(ev) { if (ev.detail && ev.detail.part && ev.detail.part.data && ev.detail.part.data.swfcfg && ev.detail.part.data.swfcfg.args) { ev = ev.detail.part.data.swfcfg.args; if (ev.ad_device) { ev.ad_device = "0"; } if (ev.ad_flags) { ev.ad_flags = 0; } if (ev.ad_logging_flag) { ev.ad_logging_flag = "0"; } if (ev.ad_preroll) { ev.ad_preroll = "0"; } if (ev.ad_slots) { delete ev.ad_slots; } if (ev.ad_tag) { delete ev.ad_tag; } if (ev.ad3_module) { ev.ad3_module = "0"; } if (ev.adsense_video_doc_id) { delete ev.adsense_video_doc_id; } if (ev.afv) { ev.afv = false; } if (ev.afv_ad_tag) { delete ev.afv_ad_tag; } if (ev.allow_html5_ads) { ev.allow_html5_ads = 0; } if (ev.csi_page_type) { ev.csi_page_type = ev.csi_page_type.replace(/watch7ad/, "watch7"); } if (ev.enable_csi) { ev.enable_csi = "0"; } if (ev.pyv_ad_channel) { delete ev.pyv_ad_channel; } if (ev.show_pyv_in_related) { ev.show_pyv_in_related = false; } if (ev.vmap) { delete ev.vmap; } } }, true);