广告去除脚本方法

影视站点广告去除脚本

Tento skript by neměl být instalován přímo. Jedná se o knihovnu, kterou by měly jiné skripty využívat pomocí meta příkazu // @require https://update.greasyfork.org/scripts/441529/1028371/%E5%B9%BF%E5%91%8A%E5%8E%BB%E9%99%A4%E8%84%9A%E6%9C%AC%E6%96%B9%E6%B3%95.js

var host = window.location.host; 
function closeAD() {
		if (host == 'v.qq.com') {
			setInterval(() => {
				try {
					let advs = $('.txp_ad').find('txpdiv').find('video');
					advs.each(function(index, vobj) {
						if (vobj.duration !== vobj.currentTime) {
							vobj.setAttribute('src', 'https://qq.com');
						}
					})
				} catch (e) {}
			}, 80);
			setInterval(function() {
				$(document).on('click', '.mod_episode a', function(e) {
					e.preventDefault()
					window.location.href = $(this).attr('href');
				})
			}, 1000)
		} else if (host == 'm.v.qq.com' || host=='3g.v.qq.com') {
			setInterval(() => {
				try {
					let advs = $('.txp_ad').find('txpdiv').find('video');
					advs.each(function(index, vobj) {
						if (vobj.duration !== vobj.currentTime) {
							vobj.setAttribute('src', 'https://qq.com');
						}
					})
				} catch (e) {}
			}, 80);
			setInterval(function() {
				$(document).on('click', '.mod_episode a', function(e) {
					e.preventDefault()
					window.location.href = $(this).attr('href');
				})
			}, 1000)
		} else if (host == 'www.iqiyi.com') {
			try {
				unsafeWindow.rate = 0;
				unsafeWindow.Date.now = () => {
					return new unsafeWindow.Date().getTime() + (unsafeWindow.rate += 1000);
				}
				setInterval(() => {
					unsafeWindow.rate = 0;
				}, 600000);
			} catch (e) {}
			setInterval(() => {
				try {
					if (document.getElementsByClassName("cupid-public-time")[0] != null) {
						$(".skippable-after").css("display", "block");
						document.getElementsByClassName("skippable-after")[0].click();
					}
					$(".qy-player-vippay-popup").css("display", "none");
					$(".black-screen").css("display", "none");
				} catch (e) {}
			}, 500);

			setInterval(function() {
				$(document).on('click', '.qy-episode-num .select-item a', function(e) {
					e.preventDefault()
					window.location.href = $(this).attr('href');
				})
			}, 1000)
		}else if (host == 'm.iqiyi.com') {
			try {
				unsafeWindow.rate = 0;
				unsafeWindow.Date.now = () => {
					return new unsafeWindow.Date().getTime() + (unsafeWindow.rate += 1000);
				}
				setInterval(() => {
					unsafeWindow.rate = 0;
				}, 600000);
			} catch (e) {}
			setInterval(() => {
				try {
					if (document.getElementsByClassName("cupid-public-time")[0] != null) {
						$(".skippable-after").css("display", "block");
						document.getElementsByClassName("skippable-after")[0].click();
					}
					$(".qy-player-vippay-popup").css("display", "none");
					$(".black-screen").css("display", "none");
				} catch (e) {}
			}, 500);

			setInterval(function() {
				$(document).on('click', '.qy-episode-num .select-item a', function(e) {
					e.preventDefault()
					window.location.href = $(this).attr('href');
				})
			}, 1000)
		} else if (host == 'v.youku.com' || host == 'v-wb.youku.com' || host=='vku.youku.com') {
			window.onload = function() {
				try {
					if (!document.querySelectorAll('video')[0]) {
						setInterval(function() {
							document.querySelectorAll('video')[1].playbackRate = 16;
						}, 100)
					}
				} catch (e) {}
			}
			setInterval(() => {
				try {
					var H5 = $(".h5-ext-layer").find("div")
					if (H5.length != 0) {
						$(".h5-ext-layer div").remove();
						var btn = $(".control-left-grid .control-play-icon");
						if (btn.attr("data-tip") === "播放") {
							$(".h5player-dashboard").css("display", "block");
							btn.click();
							$(".h5player-dashboard").css("display", "none");
						}
					}
					var adv=$('.advertise-layer').find('div').find('video');
					if(adv.length>0){
						adv.each(function(index,vobj){
							if (vobj.duration !== vobj.currentTime) {
							    vobj.currentTime = 500;
							}
						})
					}
					
					if ($(".kui-abortlayer-play-btn").html() === "播 放") {
						$(".kui-abortlayer-play-btn").click();
					}
					$(".information-tips").css("display", "none");
				} catch (e) {}
			}, 50);

		} else if (host == 'tv.sohu.com') {
			setInterval(() => {
				try {
					let vobject=$(".x-video-adv").find('video');
					vobject.each(function(index,vobj){
						 if (vobj.duration !=vobj.currentTime) {
						     vobj.currentTime = 500;
						 }
					})
					$(".x-video-adv").css("display", "none");
					$(".x-player-mask").css("display", "none");
					$("#player_vipTips").css("display", "none");
				} catch (e) {}
			}, 550);
			setInterval(function() {
				$(document).on('click', '.list_juji li a', function(e) {
					e.preventDefault()
					window.location.href = $(this).attr('href');
				})
			}, 1000)
		}else if (host == 'm.tv.sohu.com' || host=='pad.tv.sohu.com') {
			setInterval(() => {
				try {
					$('video').each(function (i,vobj) {
					    vobj.currentTime = 1000;
					});
					$(".x-video-adv").css("display", "none");
					$(".x-player-mask").css("display", "none");
					$("#player_vipTips").css("display", "none");
				} catch (e) {}
			}, 550);
			setInterval(function() {
				$(document).on('click', '.list_juji li a', function(e) {
					e.preventDefault()
					window.location.href = $(this).attr('href');
				})
			}, 1000)
		}else if(host=='www.mgtv.com' || host=='w.mgtv.com'){
			setInterval(() => {
				try {
					if($('.as_fill_player')[0]){
					                         
					                           $('video').each(function (i,vobj) {
					                               vobj.currentTime = 1000;
					                           });
					                       }
					 $('.as-pause_container').css('display', 'none');
					                    $('.as_stages-wrapper').css('display', 'none');
					                    $('.m-agreement').remove();
				} catch (e) {}
			}, 550);
		}else if(host=='m.mgtv.com'){
			setInterval(() => {
				try {
					if($('.as_fill_player')[0]){
					                         
					                           $('video').each(function (i,vobj) {
					                               vobj.currentTime = 1000;
					                           });
					                       }
					 $('.as-pause_container').css('display', 'none');
					                    $('.as_stages-wrapper').css('display', 'none');
					                    $('.m-agreement').remove();
				} catch (e) {}
			}, 550);
		}
	}