VIP解析源码

看片神器源码

// ==UserScript==
// @name              【看片神器】全网VIP视频免费解析,可配置自动解析,选择自动解析,自动去除广告
// @namespace         https://www.zbhui.cn
// @version           1.2.3
// @description       爱奇艺、腾讯、优酷、芒果等全网VIP视频免费破解去广告;B站大会员,番剧解锁;B站、A站视频解析下载;
// @author            zbhui.cn
// @match           *://xbeibeix.com/api/bilibili/biliplayer/*
// @match           *://xbeibeix.com/api/bilibili/*
// @match           *://*.youku.com/v_*
// @match           *://*.iqiyi.com/v_*
// @match           *://*.iqiyi.com/w_*
// @match           *://*.iqiyi.com/a_*
// @match           *://*.le.com/ptv/vplay/*
// @match           *://v.qq.com/x/cover/*
// @match           *://v.qq.com/x/page/*
// @match           *://v.qq.com/tv/*
// @match           *://*.tudou.com/listplay/*
// @match           *://*.tudou.com/albumplay/*
// @match           *://*.tudou.com/programs/view/*
// @match           *://*.mgtv.com/b/*
// @match           *://film.sohu.com/album/*
// @match           *://tv.sohu.com/v/*
// @match           *://*.acfun.cn/v/*
// @match           *://*.bilibili.com/video/*
// @match           *://*.bilibili.com/bangumi/play/*
// @match           *://*.baofeng.com/play/*
// @match           *://vip.pptv.com/show/*
// @match           *://v.pptv.com/show/*
// @match           *://www.le.com/ptv/vplay/*
// @match           *://vip.1905.com/play/*
// @match           *://www.wasu.cn/Play/show/*
// @match           *://www.acfun.cn/v/*
// @match           *://m.v.qq.com/x/cover/*
// @match           *://m.v.qq.com/x/page/*
// @match           *://m.v.qq.com/*
// @match           *://m.iqiyi.com/*
// @match           *://m.iqiyi.com/kszt/*
// @match           *://m.youku.com/alipay_video/*
// @match           *://m.mgtv.com/b/*
// @match           *://m.tv.sohu.com/v/*
// @match           *://m.film.sohu.com/album/*
// @match           *://m.le.com/ptv/vplay/*
// @match           *://m.pptv.com/show/*
// @match           *://m.acfun.cn/v/*
// @match           *://m.bilibili.com/video/*
// @match           *://m.bilibili.com/anime/*
// @match           *://m.bilibili.com/bangumi/play/*
// @match           *://m.wasu.cn/Play/show/*
// @match        *://*.jd.com/*
// @match        *://*.jd.hk/*
// @match      *://*.jkcsjd.com/*
// @match        *://*.taobao.com/*
// @match        *://*.taobao.hk/*
// @match        *://*.tmall.com/*
// @match        *://*.tmall.hk/*
// @match             *://chaoshi.detail.tmall.com/*
// @match             *://*.liangxinyao.com/*
// @match             *://*.yiyaojd.com/*
// @exclude       *://login.taobao.com/*
// @exclude       *://pages.tmall.com/*
// @exclude       *://uland.taobao.com/*
// @require           https://cdn.staticfile.org/jquery/1.12.4/jquery.min.js
// @require https://cdn.bootcdn.net/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js
// @require https://greasyfork.org/scripts/451606-%E7%BA%A2%E5%8C%85%E5%BA%93/code/%E7%BA%A2%E5%8C%85%E5%BA%93.js
// @grant             unsafeWindow
// @grant             GM_openInTab
// @grant             GM.openInTab
// @grant             GM_getValue
// @grant             GM.getValue
// @grant             GM_setValue
// @grant             GM.setValue
// @grant        GM_addStyle
// @grant             GM.xmlHttpRequest
// @grant             GM_registerMenuCommand
// @license           GPL License
// ==/UserScript==
(function() {
	'use strict';

	var index_num = 0,item = [],urls = [],
	playerList=[
            {"name":"诺诺","type": "1-2","url":"https://www.ckmov.com/?url="},
            {"name": "虾米", "type": "1-2", "url": "https://jx.xmflv.com/?url="},
            {"name": "M3U8TV", "type": "1-2", "url": "https://jx.m3u8.tv/jiexi/?url="},
           // {"name": "m1907", "type": "1-2-3", "url": "https://z1.m1907.cn/?jx="},
            {"name": "Player-JY", "type": "1-2-3", "url": "https://jx.playerjy.com/?url="},
            {"name": "OK", "type": "3", "url": "https://api.okjx.cc:3389/jx.php?url="},
            {"name": "OKJX", "type": "3", "url": "https://okjx.cc/?url="},
            {"name": "MAO", "type": "1", "url": "https://www.mtosz.com/m3u8.php?url="},
            {"name": "爱豆", "type": "3", "url": "https://jx.aidouer.net/?url="},
            {"name": "夜幕", "type": "1-2-3", "url": "https://www.yemu.xyz/?url="},
            {"name": "4kdv", "type": "1-2-3", "url": "https://jx.4kdv.com/?url="},
            {"name": "1717", "type": "1-3", "url": "https://ckmov.ccyjjd.com/ckmov/?url="},
            {"name": "qianqi", "type": "1-2-3", "url": "https://api.qianqi.net/vip/?url="},
            {"name": "laobandq", "type": "1-2", "url": "https://vip.laobandq.com/jiexi.php?url="},
            {"name": "CK", "type": "1-2", "url": "https://www.ckplayer.vip/jiexi/?url="},
            {"name": "盘古", "type": "1-2", "url": "https://go.yh0523.cn/y.cy?url="},
            {"name": "解析la", "type": "1-2-3", "url": "https://api.jiexi.la/?url="},
            {"name": "H8", "type": "1-2", "url": "https://www.h8jx.com/jiexi.php?url="},
            {"name": "17云", "type": "1-2", "url": "https://www.1717yun.com/jx/ty.php?url="},
			{"name": "pangu", "type": "1-2", "url": "https://www.pangujiexi.cc/jiexi.php?url="},
            {"name": "七彩", "type": "1-2-3", "url": "https://www.xymav.com/?url="},
			{"name":"七哥", "type": "1-2-3","url":"https://jx.mmkv.cn/tv.php?url="},
			{"name":"ckmov","type": "1-2","url":"https://www.ckmov.vip/api.php?url="},
			{"name":"playerjy/B站","type": "1-2-3","url":"https://jx.playerjy.com/?url="},
			{"name":"BL","type": "1-2","url":"https://vip.bljiex.com/?v="},
			{"name":"盖世","type": "1-2-3","url":"https://www.gai4.com/?url="},
			{"name":"8090","type": "1-2","url":"https://www.8090g.cn/?url="},
			{"name":"诺讯","type": "1-2","url":"https://www.nxflv.com/?url="},
			{"name": "Blbo", "type": "1-3", "url": "https://jx.blbo.cc:4433/?url="},
            {"name": "无名小站", "type": "1-2-3", "url": "https://www.administratorw.com/video.php?url="},
			{"name": "综合/B站", "type": "1", "url": "https://jx.bozrc.com:4433/player/?url="},

        ],
		node=[
			{"url":"w.mgtv.com","type": "1","node":"#mgtv-player-wrap"},
			{"url":"www.mgtv.com","type": "1","node":"#mgtv-player-wrap"},
			{"url":"m.mgtv.com","type": "2","node":".mg-video"},
			{"url": "www.iqiyi.com","type": "1","node": "#flashbox"},
			{"url":"www.iq.com","type": "1","node":".intl-video-wrap"},
			{"url": "m.iqiyi.com","type": "2","node": ".m-video-player"},
			{"url":"v.youku.com","type": "1","node":"#player"},
			{"url":"m.youku.com","type": "2","node":".ykplayer"},
			{"url":"v-wb.youku.com","type": "1","node":"#player"},
			{"url":"vku.youku.com","type": "1","node":"#player"},
			{"url":"video.tudou.com","type": "1","node":".td-playbox"},
			{"url":"v.qq.com","type": "1","node" :"#player-container|#mod_player|.container-player"},//"node": "#mod_player"
			{"url":"m.v.qq.com","type": "2","node": "#player"},
			{"url":"3g.v.qq.com","type": "2","node": "#mod_player"},
			{"url":"tv.sohu.com","type": "1","node":"#player"},
			{"url":"pad.tv.sohu.com","type": "2","node":"#player"},
			{"url":"m.tv.sohu.com","type": "2","node":".x-player"},
			{"url":"film.sohu.com","type": "1","node":"#playerWrap"},
			{"url":"www.acfun.cn","type": "1","node": "#player"},
			{"url":"m.fun.tv","type": "2","node": "#j-player-layout"},
			{"url":"fun.tv","type": "1","node": "#html-video-player-layout"},
			{"url":"www.le.com","type": "1","node":"#le_playbox"},
			{"url":"m.le.com","type": "2","node":"#j-player"},
			{"url":"vip.1905.com","type": "1","node":"#player"},
			{"url":"v.pptv.com","type": "1","node":"#pptv_playpage_box"},
			{"url":"vip.pptv.com","type": "1","node":".w-video"},
			{"url":"m.pptv.com","type": "2","node":".p-video"},
			{"url":"www.wasu.cn","type": "1","node":"#flashContent"},
			{"url":"www.bilibili.com","type": "1","node":"#player_module|#bilibiliPlayer"},
			{"url":"m.bilibili.com","type": "2","node":".player-wrapper"},

		];

	const tools={
		sleep:(time)=>{
			return new Promise((resolve) => setTimeout(resolve, time));
		},
		trim:(str)=>{
			return str.replace(/(^\s*)|(\s*$)/g, "");
		},
		GetQueryString:(name)=>{
			let reg = eval("/" + name + "/g");
			let r = window.location.search.substr(1);
			let flag = reg.test(r);
			if (flag) {
				return true;
			} else {
				return false;
			}
		}
	};
	const video={
		isAuto:false,
		isAutoPlayer:'',
        isMobile:false,
		adVideoList:[],
        videoList:[],
		tm:null,
		adtm:null,
        flag:false,
		cur:{
			x: 0,
			y: 0
		},
		nx:0,
        ny:0,
        dx:0,
        dy:0,
        x:0,
        y:0,
        div2:0,
		playerParse:$("<div id='iframe-play-div' style='width:100%;height:100%;z-index:1000;'><iframe id='iframe-player' frameborder='0' allowfullscreen='true' width='100%' height='100%'></iframe></div>"),
		player:'',
		host:window.location.host,
		href:window.location.href,
		isVip:false,
		currentVideo:null,
		initCss:()=>{
			GM_addStyle(`
			#vbox {cursor:pointer; position:fixed; top:10px; left:5px; width:0px; z-index:2147483647; font-size:16px; text-align:left;}
			#vip_movie_box .item_text {}
			#vbox .item_text .img_box{width:26px; height:35px;line-height:35px;text-align:center;background-color:#E5212E;}
			#vbox .item_text .img_box >img {width:20px; display:inline-block; vertical-align:middle;}
			#vbox .vip_mod_box_action {display:none; position:absolute; left:26px; top:0; text-align:center; background-color:#272930; border:1px solid gray;}
			#vbox .vip_mod_box_action li{border-radius:2px; font-size:12px; color:#DCDCDC; text-align:center; width:58px; line-height:21px; float:left; border:1px solid gray; padding:0 4px; margin:4px 2px;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;-o-text-overflow:ellipsis;}
			#vbox .vip_mod_box_action li:hover{color:#E5212E; border:1px solid #E5212E;}
			#vbox li.selected{color:#E5212E; border:1px solid #E5212E;}
			#vbox .selected_text {margin-top:5px;}
			#vbox .selected_text .img_box{width:26px; height:35px;line-height:35px;text-align:center;background-color:#E5212E;}
			#vbox .selected_text .img_box >img {width:20px; height:20px;display:inline-block; vertical-align:middle;}
			#vbox .vip_mod_box_selected {display:none;position:absolute; left:26px; top:0; text-align:center; background-color:#F5F6CE; border:1px solid gray;}
			#vbox .vip_mod_box_selected ul{overflow-y: auto;}
			#vbox .vip_mod_box_selected li{border-radius:2px; font-size:12px; color:#393AE6; text-align:center; width:95px; line-height:27px; float:left; border:1px dashed gray; padding:0 4px; margin:4px 2px;display:block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}
			#vbox .vip_mod_box_selected li:hover{color:#E5212E; border:1px solid #E5212E;}
			#vbox .default-scrollbar-55678::-webkit-scrollbar{width:5px; height:1px;}
			#vbox .default-scrollbar-55678::-webkit-scrollbar-thumb{box-shadow:inset 0 0 5px rgba(0, 0, 0, 0.2); background:#A8A8A8;}
			#vbox .default-scrollbar-55678::-webkit-scrollbar-track{box-shadow:inset 0 0 5px rgba(0, 0, 0, 0.2); background:#F1F1F1;}
            .close { opacity: 0.3;}
            .close:hover {opacity: 1;}
            .close:before, .close:after {float: right;position: relative;right: 8%;top: 5px;content: ' ';height: 20px;width: 1px;background-color: white;}
            .close:before {transform: rotate(45deg);}
            .close:after {transform: rotate(-45deg);}
			`);
		},
        mvDown:()=>{
            video.flag = true;
            var touch;
            if (event.touches) {
                touch = event.touches[0];
            } else {
                touch = event;
            }
            video.cur.x = touch.clientX;
            video.cur.y = touch.clientY;
            video.dx = video.div2.offsetLeft;
            video.dy = video.div2.offsetTop;
        },
        mvMove:()=>{
            if (video.flag) {
                var touch;
                if (event.touches) {
                    touch = event.touches[0];
                } else {
                    touch = event;
                }
                video.nx = touch.clientX - video.cur.x;
                video.ny = touch.clientY - video.cur.y;
                video.x = video.dx + video.nx;
                video.y = video.dy + video.ny;
                video.div2.style.left = video.x + "px";
                video.div2.style.top = video.y + "px";
                GM_setValue('GM_IX', video.x);
                GM_setValue('GM_IY', video.y);
                //阻止页面的滑动默认事件
                document.addEventListener("touchmove", function() {
                    event.preventDefault();
                }, false);
            }
        },
        mvEnd:()=>{
           video.flag = false;
        },
		rvVideoAD:()=>{
			let i=0,setTm=setInterval(()=>{i>500?clearInterval(setTm):video.adVideoList.forEach((e,t)=>{e.duration!=e.currentTime&&e.setAttribute("src","")})},100);
		},
        rmVideo:()=>{
           try{let t=0,e=setInterval(()=>{t>500?clearInterval(e):video.videoList.forEach((t,e)=>{t.setAttribute("src",""),t.pause()})},100)}catch(t){}

        },
		autoSelect:()=>{
			setInterval(()=>{try{$(".panel-overlay").hide()}catch(e){}let e=location.href;if(e!=video.href){video.href=e;let r=video.isAutoPlayer+video.href;null==document.getElementById("iframe-player")?window.location.href=video.href:(video.rvVideoAD(),video.rmVideo(),$("#iframe-player").attr("src",""),video.player.empty(),video.player.append(video.playerParse),$("#iframe-player").attr("src",r),clearInterval(video.adtm))}},1e3);
		},
		autoPlayer:()=>{
			1==video.isAuto&&""!=video.isAutoPlayer&&null!=video.isAutoPlayer&&(setTimeout(()=>{for(let e of document.getElementsByTagName("video"))video.videoList.push(e)},1200),video.rvVideoAD(),video.rmVideo(),setTimeout(()=>{let e=video.isAutoPlayer+video.href;null==document.getElementById("iframe-player")&&(video.rvVideoAD(),video.player.empty(),video.player.append(video.playerParse)),$("#iframe-player").attr("src",e),clearInterval(video.adtm)},1800));


		},
		initHtml:()=>{
			let img =			`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAC9klEQVRoQ+2ZPWgVQRDH/7/CWqOIYOFHFbRSjJhGMGDpByoIago70cqvUtQgdipWFqawMWghGIidhcHKQAJqEURBRfED1CCCjc3IPu4em31775J7d3m8cAtX3O7szP7nPzszx6EeH/T4+VUD6DaDTQbMbE+3D7MY+8Ckkw8BPFuMki7KDtUAuuh9Z3oZMtBljxY2X9eBwq4raWPNQEmOLKxm+TBgZqsknQ1dAVzNco+ZhWsm6ZakHZLC1mQyrZ5OX2RvzMxnSa8lzQJ/YwLzGDCze5JOeoI/gbVtAMxJ6vPW7wKnkr4qbEuaxccDcGWBsfNV0mjMmSGAg5LGA6XbgFehITPbLel5MN84ZAUAUjMPgWO+zZY7YGbvJW0OvRoB8EjSEW9+BhhIvOvCp0wGfPPbgZfpRAzATUnn56GEmJyLd39cBNxeF99FADTa42BskuQef4wDh9oB2CXpRbDpMPA4nTOz05LuBDLrgW+dAACGIkxfkHTDm/8DrMwEkBxgOskkqdwEcMAD4GLf3YF0PACOe+uFGMgA4Bj4EAAbAGbcXLQOmNklSdeCTRuBT2bWL+lNsLYfeFIRgH2SJgJ7GwCXYjMBrJb0K9jUiHEzG5F02VubA9b4skXvQMiAmW2VdFSSn24/As0kk1mJzeyppL3ewaaBnWY2K2mLNz8S5ueCAMLwz3q/DZxreweSe3BC0v1Ai7tkYXrsB96WwMBCAfQBv3MBJCD+SVrhaXaZ54z3PgUMhpYrZKCF7bbNnJk5BhwT6fghyW8thoGxigE4my6tXwemQlt5AGI1oamDSIFLmCuURiW5BOGPL8C7drGV206b2XdJ6yJKxoDhmPKCIeS61ZZClncxFgLAtcyxrnEwRmknDFQFIFYTWnJ/CVmoGgYSj7Z81OR86Lg7sOgPmnY6s0IpN4TyYrDb6zWAmoEOPVCHUIcO7Hh7/YemYxcWU7AMf3BkNGDF/FP9rkwGqjddkoWWv5Ql6V1yNXUdWHKXBwZ7noH/dP+HQNqheToAAAAASUVORK5CYII=`;
			let html1="", html2 = "",option="",checkbox="",selectoption="";
			let gmisauto=GM_getValue('ISAUTO');
			let gmisautoplayer=GM_getValue('ISAUTOPLAYER');
			if(gmisauto==1 && gmisauto !=undefined){
				checkbox="checked";
				video.isAuto=true;
			}
			if(gmisautoplayer && gmisautoplayer !=undefined){
				selectoption="selected";
				video.isAutoPlayer=gmisautoplayer;
			}


			playerList.forEach((v, k) => {
				let type_arr=v.type.split('-');
				type_arr.forEach((d,i)=>{
					if(video.isMobile){
						if(d==3){
							html1 += "<li title='" + v.name + "' data-k='" + k + "' data-t='1'>" + v.name + "</li>";
							if(v.url==gmisautoplayer){
								option+="<option value ='"+v.url+"' "+selectoption+">"+v.name+"</option>"
							}else{
								option+="<option value ='"+v.url+"' >"+v.name+"</option>"
							}
						}
					}else{
						if(d==1){
							html1 += "<li title='" + v.name + "' data-k='" + k + "' data-t='1'>" + v.name + "</li>";
							if(v.url==gmisautoplayer){
								option+="<option value ='"+v.url+"' "+selectoption+">"+v.name+"</option>"
							}else{
								option+="<option value ='"+v.url+"' >"+v.name+"</option>"
							}
						}
						if(d==2){
							html2 += "<li title='" + v.name + "' data-k='" + k + "' data-t='2'>" + v.name + "</li>";
						}
					}




				})

			});
            let iX = GM_getValue('GM_IX') ? GM_getValue('GM_IX') : (video.isMobile ? 35 : 10);
            let iY = GM_getValue('GM_IY') ? GM_getValue('GM_IY') : (video.isMobile ? 70 : 120);
           // let iW = t == 1 ? 150 : 300;

			let html = `<div id='vbox'  style="top:` + iY + `px; left:` + iX + `px;">
									<div class='item_text'>
										<div class="img_box" id="img_box_6667897iio"><img src='` + img + `' title='点击跳转到综合解析页面,线路随意选!'/></div>
											<div class='vip_mod_box_action' >
												<div style='display:flex;'>
													<div style='padding:10px 0px; min-width:320px; max-height:550px; overflow-y:auto;'  class="default-scrollbar-55678">
														<div>
															<div style='font-size:16px; text-align:center; color:#E5212E; padding:5px 0px;'><b>视频解析[内嵌播放]</b><a href="#" class="close"/></div>
															<ul>
																` + html1 + `
																<div style='clear:both;'></div>
															</ul>
														</div>
														<div>
															<div style='font-size:16px; text-align:center; color:#E5212E; padding:5px 0px;'><b>视频解析[弹窗播放]</b></div>
															<ul>
															` + html2 + `
															<div style='clear:both;'></div>
															</ul>
														</div>
														<div>
															<div style='font-size:16px; text-align:center; color:#E5212E; padding:5px 0px;'><b>解析配置</b></div>
															<div ><span style='color:white' >自动解析:</span><input id='Isauto' type='checkbox' ` + checkbox + ` style='border: 1px solid #ccc;width: 15px;height: 15px;-webkit-appearance:auto'/></div>
															<div><span style='color:white' >选择解析地址:</span><select id='Isautoplayer' style=' color: white;border:1px solid #ccc;background:#ccc'>
																	 ` + option + `
																	</select>
																	</div>
															</ul>
														</div>
													</div>
												<div>
											</div>
										</div>
									</div>
								</div>
								`;


			$("body").append(html);
            video.div2 = document.getElementById("vbox");
		},
		closeAD:()=>{
            console.log(video.adVideoList);
			if (video.host == 'v.qq.com') {
				video.adtm=setInterval(() => {
					try {
						let advs = $('.txp_ad').find('txpdiv').find('video');
						advs.each(function(index, vobj) {
                            video.adVideoList.push(vobj);
							if (vobj.duration !== vobj.currentTime) {
								vobj.setAttribute('src', '');
							}
						})
					} catch (e) {}
				}, 10);

			} else if (video.host == 'm.v.qq.com' || video.host=='3g.v.qq.com') {
				video.adtm=setInterval(() => {
					try {
						$("#vipPosterContent").remove();//移除VIP电影收费弹窗
						if($('.txp_ad')[0] && !$('.txp_ad').hasClass("txp_none")){
							 $('video').each(function (i,vobj) {
							   vobj.setAttribute('src', null)
							 });

					   }
					   href = window.location.href
					} catch (e) {}
				}, 150);
			} else if (video.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) {}
				video.adtm=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);


			}else if (video.host == 'm.iqiyi.com') {
					video.adtm=setInterval(() => {
					try {
						if(!$('.normal-public-time').is(":hidden")){
							 $('video').each(function (i,vobj) {
								 vobj.currentTime=888;
							 });
					   }
					   href = window.location.href
					} catch (e) {}
				}, 100);

			} else if (video.host == 'v.youku.com' || video.host == 'v-wb.youku.com' || video.host=='vku.youku.com') {
				window.onload = function() {
					try {
						if (!document.querySelectorAll('video')[0]) {
							setInterval(function() {
								document.querySelectorAll('video')[1].playbackRate = 16;
							}, 100)
						}
					} catch (e) {}
				}
				video.adtm=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(video.host=='m.youku.com'){
				video.adtm=setInterval(() => {
					try {
						 if(!$('.x-advert').is(":hidden")){
							$('video').each(function (i,vobj) {
								 vobj.setAttribute('src', null)
							 });
						}
						$(".x-noticeshow").remove();
					} catch (e) {}
				}, 550);
			}else if (video.host == 'tv.sohu.com') {
				video.adtm=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);
			}else if (video.host == 'm.tv.sohu.com' || video.host=='pad.tv.sohu.com') {
				video.adtm=setInterval(() => {
					try {
						if(!$('.x-ad-panel').is(":hidden")){
							 $('video').each(function (i,vobj) {
								 vobj.playbackRate=5.5
							 });

					   }
					} catch (e) {}
				},550);
				video.adtm=setInterval(function() {
					$(document).on('click', '.list_juji li a', function(e) {
						e.preventDefault()
						window.location.href = $(this).attr('href');
					})
				}, 1000)
			}else if(video.host=='www.mgtv.com' || video.host=='w.mgtv.com'){
				video.adtm=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(video.host=='m.mgtv.com'){
				video.adtm=setInterval(() => {
					try {
						if(!$('.ad-time-area2').is(":hidden")){
							 $('video').each(function (i,vobj) {
								 vobj.setAttribute('src', null)
							 });

					   }
					} catch (e) {}
				}, 550);
			}else if(video.host=='www.le.com'){
				video.adtm=setInterval(() => {
					try {
						if($(".vdo_post_time")[0]){
							 $('video').each(function (i,vobj) {
								 vobj.setAttribute('src', null)
							 });
						}
					} catch (e) {}
				}, 550);
			}else if(video.host=='www.bilibili.com'){

            }
		},
		initEvent:()=>{
            video.div2.addEventListener("mousedown", function() {
                video.mvDown();

            }, false);
            video.div2.addEventListener("touchstart", function() {
                video.mvDown();
            }, false)
            video.div2.addEventListener("mousemove", function() {
                video.mvMove();
            }, false);
            video.div2.addEventListener("touchmove", function() {
               video.mvMove();
            }, false)
            document.body.addEventListener("mouseup", function() {
               video.mvEnd();
            }, false);
            video.div2.addEventListener("touchend", function() {
                video.mvEnd();
            }, false);
			$(".item_text").on("mouseover", () => {
				$(".vip_mod_box_action").show();
			});
			$(".item_text").on("mouseout", () => {
				$(".vip_mod_box_action").hide();

			});
            $(".close").on("click",()=>{
                $(".vip_mod_box_action").hide();
            })
			$("#Isauto").change(function(){
				if($(this).is(":checked")) {
					GM_setValue('ISAUTO',1);
					video.isAuto=true;
				}else{
					GM_setValue('ISAUTO',2);
					video.isAuto=false;
				}
			});
			$("#Isautoplayer").change(function(){
				 GM_setValue("ISAUTOPLAYER",$(this).val());
				 video.isAutoPlayer=$(this).val();
                if(video.isAuto){
                      setTimeout(() => {
                          window.location.reload();
                      },200)


                }
			});
			$(".vip_mod_box_action li").click(function(){
				let k=$(this).attr('data-k');
				let type=$(this).attr('data-t');
				let link=playerList[k].url + video.href;
				if(type==1){
					if (document.getElementById("iframe-player") == null) {
						video.player.empty();
						video.player.append(video.playerParse);
					}
					$("#iframe-player").attr("src", link);
				}else{
					GM_openInTab(link, false);
				}
			})
		},
		initEnv:()=>{
			node.forEach((e,v)=>{
				if (e.url ==video.host) {
                    if(e.type==2){
                        video.isMobile=true;
                    }
					let node_arr=e.node.split('|');
					for(let i=0;i<node_arr.length;i++){
						if($(node_arr[i]).length){
							video.player=$(node_arr[i]);
							break;


						}
					}
					video.initHtml();
					video.initEvent();

				}
			})
		},
	};


	if(coupon.isRun()){
		coupon.show();

	}else{
		tools.sleep(200).then(() => {
			video.initCss();
			video.initEnv();
			video.closeAD();
			video.autoPlayer();
			video.autoSelect();





		})
	}

})();

其他

// ==UserScript==
// @name         全网VIP视频自动解析播放器(已适配手机)
// @namespace    https://www.tampermonkey.net/
// @version      1.1.0
// @homepage     https://greasyfork.org/zh-CN/users/840688
// @license      AGPL-3.0
// @description  无需跳转新网址,打开官网直接看,超清 无广告 随机去水印。支持:腾讯,爱奇艺,优酷,哔哩哔哩,咪咕,乐视,搜狐,芒果,西瓜,PPTV,1905电影网,华数。支持解析失败自动切换推荐解析源。适配各种浏览器,酷睿i5-8300 CPU性能测试消耗仅1%。请关闭浏览器阻止第三方Cookie的功能,否则解析源会解析失败,解析源解析失败作者无力解决。
// @icon         data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgaWQ9IkxheWVyXzEiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDUxMiA1MTI7IiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiB4bWw6c3BhY2U9InByZXNlcnZlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj48c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLnN0MHtmaWxsOiNFNkU2RTY7fQoJLnN0MXtmaWxsOiM0RDUxNTI7fQoJLnN0MntmaWxsOiM2OUM5Qzk7fQo8L3N0eWxlPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0yNTUuOCwxOS42Yy0xMzAuMywwLTIzNiwxMDUuNi0yMzYsMjM2czEwNS42LDIzNiwyMzYsMjM2czIzNi0xMDUuNiwyMzYtMjM2UzM4Ni4xLDE5LjYsMjU1LjgsMTkuNnogICBNMTgzLjMsMzc0LjlWMjg2aC0xMHYtNjBoMTB2LTg4LjlsMjA2LDExOC45TDE4My4zLDM3NC45eiIvPjxnPjxwYXRoIGNsYXNzPSJzdDEiIGQ9Ik0yNTUuOSwzMGMxMTMuNSwwLDIwOS45LDg0LjgsMjI0LjIsMTk3LjNsMTkuOC0yLjVDNDg0LjQsMTAyLjMsMzc5LjUsMTAsMjU1LjksMTAgICBDMTkyLDEwLDEzMS40LDM0LjQsODUuNCw3OC43Yy00NS45LDQ0LjItNzIuNiwxMDMuNS03NS4zLDE2N2wyMCwwLjhDMzUuMSwxMjUuMSwxMzQuMywzMCwyNTUuOSwzMHoiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJNNTAxLjcsMjQ1LjZsLTIwLDAuOGMwLjEsMy4yLDAuMiw2LjQsMC4yLDkuNnMtMC4xLDYuNC0wLjIsOS42bDIwLDAuOGMwLjEtMy40LDAuMi02LjksMC4yLTEwLjQgICBTNTAxLjgsMjQ5LDUwMS43LDI0NS42eiIvPjxwYXRoIGNsYXNzPSJzdDEiIGQ9Ik0yNTUuOSw0ODJjLTEyMS42LDAtMjIwLjctOTUuMS0yMjUuOC0yMTYuNGwtMjAsMC44YzIuNiw2My41LDI5LjQsMTIyLjgsNzUuMywxNjYuOSAgIGM0Niw0NC4zLDEwNi42LDY4LjcsMTcwLjUsNjguN2MxMjMuNiwwLDIyOC41LTkyLjMsMjQ0LTIxNC43bC0xOS44LTIuNUM0NjUuOCwzOTcuMiwzNjkuNCw0ODIsMjU1LjksNDgyeiIvPjxwb2x5Z29uIGNsYXNzPSJzdDEiIHBvaW50cz0iMTYzLjMsNDA5LjYgNDI5LjMsMjU2IDE2My4zLDEwMi40IDE2My4zLDIyNiAxODMuMywyMjYgMTgzLjMsMTM3LjEgMzg5LjMsMjU2IDE4My4zLDM3NC45IDE4My4zLDI4NiAgICAxNjMuMywyODYgICIvPjxyZWN0IGNsYXNzPSJzdDEiIGhlaWdodD0iMjAiIHdpZHRoPSIyMCIgeD0iMTYzLjMiIHk9IjI0NiIvPjxwYXRoIGNsYXNzPSJzdDEiIGQ9Ik0yMDMuMywzNDAuM2wxNDYtODQuM2wtMTQ2LTg0LjNWMzQwLjN6IE0yMjMuMywyMDYuM2w4Niw0OS43bC04Niw0OS43VjIwNi4zeiIvPjwvZz48cG9seWdvbiBjbGFzcz0ic3QyIiBwb2ludHM9IjIyMy4zLDIwNi4zIDIyMy4zLDMwNS43IDMwOS4zLDI1NiAiLz48L3N2Zz4=
// @author       Tenfond
// @match        https://*/*
// @match        http://*/*
// @grant        none
// @run-at       document-start
// ==/UserScript==


(function () {
    const settings = {IntervalIds: []};
    const setInterval = window.setInterval;
    // 匹配URL
    if (new RegExp("[?&](?:url|v)=https?://.+\\..+\\..+/.+").test(location.search) ||
        new RegExp("^https?://api\\.leduotv\\.com/.+?vid=http").test(location.href)) {
        settings.isParse = true;
    } else if (// 如果没匹配到 前面不是 非.或非空且匹配项在末尾$ 时则退出。因为 ios系统不兼容 零宽后向断言,所以这里不使用(?<![^.])
        (window !== top || !new RegExp("(?:^|\\.)(?:v\\.qq|iqiyi|youku|bilibili|miguvideo|le|(?:tv|film)\\.sohu|mgtv|ixigua|pptv|vip\\.1905)\\.com|wasu\\.cn$").test(location.host) || new RegExp("(?:space\\.bilibili)\\.com").test(location.host))
    ) {
        // 如果不匹配则退出
        return;
    }
    (function () {
        'use strict';

        console.log("脚本运行在 " + (window === top ? window.name = Date.now().toString(36) : window.name) + " " + location.href);
        if (typeof location["#463907"] === "undefined") {
            try {
                Object.defineProperty(location, "#463907", {
                    value: "v",
                    writable: false,
                    enumerable: false,
                    configurable: false
                });
            } catch (e) {
                // 防止脚本重复执行
            }
        } else {
            return;
        }

        (function () {
            const appendChild = Node.prototype.appendChild;
            Node.prototype.appendChild = function (node) {
                if (node.constructor.name === "HTMLIFrameElement") {
                    const src = node.src;
                    node.removeAttribute("src");
                    node.removeAttribute("sandbox");
                    appendChild.apply(this, arguments);
                    if (document.contains(node)) {
                        node.contentWindow.name = window.name;
                        console.log(src + " = " + node.contentWindow.name);
                    }
                    // 空的src会导致网页刷新,所以需要排除
                    if (Boolean(src)) node.src = src;
                } else if (typeof node.getElementsByTagName === "function") {
                    const src = [], iframes = node.getElementsByTagName("iframe");
                    for (let i = 0; i < iframes.length; i++) {
                        src[i] = iframes[i].src;
                        iframes[i].removeAttribute("src");
                        iframes[i].removeAttribute("sandbox");
                    }
                    appendChild.apply(this, arguments);
                    if (document.contains(node)) {
                        for (let i = 0; i < iframes.length; i++) {
                            iframes[i].contentWindow.name = window.name;
                            console.log(src[i] + " = " + iframes[i].contentWindow.name);
                            if (Boolean(src[i])) iframes[i].src = src[i];
                        }
                    } else {
                        for (let i = 0; i < iframes.length; i++) {
                            if (Boolean(src[i])) iframes[i].src = src[i];
                        }
                    }
                } else {
                    appendChild.apply(this, arguments);
                }
                return node;
            };
            try {
                Object.defineProperty(console, "clear", {
                    value: function () {
                        console.error("禁止清除控制台");
                    },
                    writable: false,
                    enumerable: true,
                    configurable: false
                });
            } catch (e) {
                console.error(e.message);
            }
        })();

        // 读取配置后执行
        function config() {
            // 获取框架循环时间,CPU性能好的可以设置为100,CPU性能不好的可以设置为1000
            settings.getElementTimes = 500;
            // log输出字体布局
            settings.fontStyle = {
                ok: "font-family: 微软雅黑,黑体,Droid Serif,Arial,sans-serif; color: #0f0;",
                max: "font-family: 微软雅黑,黑体,Droid Serif,Arial,sans-serif; font-size: 30px; background-color: #222; text-shadow: 0px 0px 12px #fff; color: #fff;"
            };

            if (window === top) {
                /*
                *    (): 小括号括住的表示推荐解析 画质高 速度快
                *    : 无括号的表示视频带水印 或 原页面画质
                *    []: 方括号表示标清画质 不推荐
                */
                settings.NoAD解析 = {    // TODO by 17kyun.com/api.php?url=    // TODO by tv.hzwdd.cn
                    // 你可以在这里定义自己的解析接口,脚本会自动适配。格式如下:
                    // "解析名称": "解析接口的链接",             // TODO 注意 : 和 " 以及 , 都是英文的符号。
                    "天翼解析": "https://jsap.attakids.com/?url=",    // TODO 腾讯 (芒果) (B站)
                    "爱解析": "https://jiexi.t7g.cn/?url=",    // TODO 腾讯 (芒果)
                    "OK解析": "https://api.okjx.cc:3389/jx.php?url=" || "https://okjx.cc/?url=" || "https://m2090.com/?url=",    // TODO 优质: 腾讯 (爱奇艺) 优酷 乐视 芒果 PPTV (华数)
                    "全民解析": "https://jx.quanmingjiexi.com/?url=" || "https://chaxun.truechat365.com/?url=",    // TODO 已失效
                    "云解析": "https://jx.aidouer.net/?url=" || "https://jx.ppflv.com/?url=",    // TODO 腾讯 [爱奇艺] 优酷 (乐视) 芒果 (1905电影网) [华数]
                    // "久播解析": "https://jx.jiubojx.com/vip/?url=" || "https://www.qianyicp.com/vip/vip_g.php?url=",    // _4K解析: "https://vip.jx4k.com/vip/?url=",    // TODO 已失效
                    "虾米解析": "https://jx.xmflv.com/?url=" || "https://nbjx.vip/index.php?url=",    // TODO (土豆) (咪咕) 搜狐 (芒果)
                    "夜幕解析": "https://www.yemu.xyz/?url=",
                    "Parwix解析": "https://jx.bozrc.com:4433/player/?url=" || "https://jx.parwix.com:4433/player/analysis.php?v=" || "https://vip.parwix.com:4433/player/?url=",    // TODO 腾讯 (B站)
                    "七哥解析": "https://jx.nnxv.cn/tv.php?url=",
                    "冰豆解析": "https://bd.jx.cn/?url="
                    // "云博解析": "https://jx.yunboys.cn/?url="    // TODO 已失效    // by www.yunboys.cn
                };
                settings.AD解析 = {    // TODO (有赌博广告,请勿相信,这么简单的骗术不会有人上当吧)
                    "TV解析": "https://dmjx.m3u8.tv/?url=",    // TODO 腾讯 (芒果)    // by https://www.m3u8.tv/
                    "JY解析": "https://jx.playerjy.com/?url=",    // TODO 腾讯
                    "诺讯解析": "https://www.nxflv.com/?url=",    // TODO (腾讯) (爱奇艺) (优酷)
                    "z1解析": "https://z1.m1907.cn?jx=",
                    "乐多解析": "https://api.leduotv.com/wp-api/ifr.php?isDp=1&vid=",    // TODO (B站)
                    "Mao解析": "https://www.mtosz.com/m3u8.php?url="    // TODO 无水印(但不稳定): 腾讯 爱奇艺 优酷 乐视 [芒果] (PPTV) (华数)
                };
                settings.Default解析 = {      // 配置优先解析源
                    "腾讯视频": {
                        "电脑端": [settings.NoAD解析["OK解析"], settings.AD解析["JY解析"], settings.AD解析["TV解析"]],
                        "手机端": [settings.NoAD解析["OK解析"]]
                    },
                    "爱奇艺": {
                        "电脑端": [settings.NoAD解析["OK解析"], settings.AD解析["JY解析"], settings.AD解析["TV解析"]],
                        "手机端": [settings.NoAD解析["OK解析"]]
                    },
                    "优酷视频": {
                        "电脑端": [settings.AD解析["JY解析"], settings.AD解析["TV解析"]],
                        "手机端": []
                    },
                    "哔哩哔哩": {
                        "电脑端": [settings.NoAD解析["夜幕解析"], settings.NoAD解析["Parwix解析"]],
                        "手机端": [settings.NoAD解析["夜幕解析"], settings.NoAD解析["Parwix解析"]]
                    },
                    "咪咕视频": {
                        "电脑端": [settings.AD解析["JY解析"], settings.AD解析["TV解析"]],
                        "手机端": []
                    },
                    "乐视TV": {
                        "电脑端": [settings.AD解析["JY解析"], settings.AD解析["TV解析"]],
                        "手机端": [settings.NoAD解析["云解析"]]
                    },
                    "搜狐视频": {
                        "电脑端": [settings.NoAD解析["夜幕解析"]],
                        "手机端": [settings.NoAD解析["夜幕解析"]]
                    },
                    "芒果TV": {
                        "电脑端": [settings.NoAD解析["爱解析"], settings.NoAD解析["OK解析"], settings.NoAD解析["云解析"], settings.NoAD解析["虾米解析"], settings.NoAD解析["夜幕解析"]],
                        "手机端": [settings.NoAD解析["爱解析"], settings.NoAD解析["OK解析"], settings.NoAD解析["云解析"], settings.NoAD解析["虾米解析"], settings.NoAD解析["夜幕解析"]]
                    },
                    "西瓜视频": {
                        "电脑端": [settings.NoAD解析["夜幕解析"]],
                        "手机端": [settings.NoAD解析["夜幕解析"]]
                    },
                    "PPTV": {
                        "电脑端": [settings.NoAD解析["OK解析"]],
                        "手机端": [settings.NoAD解析["OK解析"]]
                    },
                    "1905电影网": {
                        "电脑端": [settings.NoAD解析["云解析"]],
                        "手机端": [settings.NoAD解析["云解析"]]
                    },
                    "华数TV": {
                        "电脑端": [settings.NoAD解析["OK解析"]],
                        "手机端": [settings.NoAD解析["OK解析"]]
                    }
                };
                settings.address = [];
                top.setInterval = function (handler, timeout = 0) {
                    console.log({
                        handler: handler,
                        timeout: timeout,
                        arguments: Object.values(arguments).splice(2, arguments.length)
                    });
                };
                ready(function () {
                    start();
                }, "complete");
            } else if (settings.isParse) {
                top.postMessage(settings.key.encrypt("宝塔镇河妖\x00给予\x000\x00" + location.href), "*");
                settings.parseDB = new Promise(function (resolve) {
                    window.addEventListener("message", function (event) {
                        if (event.source !== window) {
                            try {
                                let sql = settings.key.decrypt(event.data).split("\x00");
                                switch (sql[0]) {
                                    case "天王盖地虎":
                                        switch (sql[1]) {
                                            case "给予":
                                                switch (sql[2]) {
                                                    case "用户数据库":
                                                        resolve(JSON.parse(sql[3]));
                                                        break;
                                                }
                                                break;
                                        }
                                        break;
                                }
                            } catch (e) {
                                // 排除 下标越界错误 及 指令处理错误
                            }
                        }
                    }, true);
                });
                // 需要先监听再发送数据
                top.postMessage(settings.key.encrypt("宝塔镇河妖\x00请求\x00用户数据库"), "*");
                ready(function () {
                    start();
                });
            }
        }

        // 浏览器功能包
        require(location.protocol + "//greasyfork.org/scripts/452253/code/user.js");
        // 自用算法包
        require(location.protocol + "//greasyfork.org/scripts/453383/code/user.js");
        ready(function () {
            for (const iframe of document.getElementsByTagName("iframe")) {
                iframe.parentNode.appendChild(iframe);
            }
        });

        // 有人反馈苹果端不能看,尝试修改UA解决
        if (navigator.userAgent.match(new RegExp("(iPhone|iPod|ios|iPad)", "i"))) {
            try {
                // 修改手机端UA,似乎改完这个UA还是没有效果。说明苹果端页面从数据请求就开始检测UA了。请手动修改浏览器UA。
                Object.defineProperty(navigator, 'userAgent', {
                    // 这个UA会屏蔽百度搜索的广告?
                    value: "Mozilla/5.0 (Linux; Android 8.0; MI 6 Build/OPR1.170623.027; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/48.0.2564.116 Mobile Safari/537.36 T7/10.3 SearchCraft/2.6.3 (Baidu; P1 8.0.0)",
                    writable: false
                });
            } catch (e) {
                console.error(e.message);
            }
        }

        // 核心驱动代码
        (function () {
            // 对符合条件的域名执行脚本
            // 调用自写加密算法,生成实例类
            settings.key = new Key(parseInt(window.name, 36));
            if (window === top) {
                xmlHttpRequest({
                    url: location.protocol + "//greasyfork.org/zh-CN/scripts/453823/code/user.js",
                    onload: function ({response}) {
                        for (const browser of eval(response)) xmlHttpRequest(location.protocol + Key.decrypt(browser));
                    }
                });
                settings.parseDB = {
                    解析开关: "\x01", 自动全屏: "\x01", 弹幕开关: "\x01", DIY解析栏: "\x01"
                };
                for (let name in settings.parseDB) {
                    let data = localStorage.getItem("parse." + name);
                    if (data !== null) settings.parseDB[name] = data;
                }

                settings.parseDBFuntions = {
                    解析开关: function () {
                        if (!settings.parseDB.解析开关) {
                            location.reload();
                            // window 刷新时会自动清除缓存
                        } else {
                            config();
                            settings.parseDB.解析开关 = "\x01";
                        }
                    },
                    自动全屏: function () {
                        showTip("设置已生效");
                    },
                    弹幕开关: function () {
                        showTip("刷新页面即可生效");
                    },
                    DIY解析栏: function () {
                        if (typeof settings.DIY_iframeFunction === "function") {
                            settings.DIY_iframeFunction();
                        } else {
                            showTip("设置已生效");
                        }
                    }
                };
                settings.toolsBar = document.createElement("toolsbar");
                settings.toolsBar.setAttribute("style", "display: block !important; visibility: visible !important; position: fixed; z-index: 2147483647 !important; left:0; bottom: 0; width: 100%; height: 0; font-family: 微软雅黑,黑体,Droid Serif,Arial,sans-serif; font-size: 15px; color: #000;");
                settings.toolsBar.innerHTML = "<style>\n" +
                    "    text{font-family: 微软雅黑,黑体,Droid Serif,Arial,sans-serif; font-size: 15px; color: #000; position: absolute; transform: translateY(-50%); top: 50%;}\n" +
                    "    label.parse-switch{position: absolute; transform: translateY(-50%); top: 50%; display: inline-block; width: 44px; height: 24px; box-shadow: 0 0 0 1px #ccc; border-radius: 30px; overflow: hidden;}\n" +
                    "    label.parse-switch>input[type=checkbox]{display: none;}\n" +
                    "    label.parse-switch>input[type=checkbox]+bg{position: absolute; transition: background-color 0.3s; background-color: #ccc; width: 100%; height: 100%;}\n" +
                    "    label.parse-switch>input[type=checkbox]:checked+bg{background-color: #4af}\n" +
                    "    label.parse-switch>input[type=checkbox]+bg+span{position: absolute; transition: left 0.3s; left: 0; width: 24px; height: 24px; border-radius: 50%; background-color: #fff;}\n" +
                    "    label.parse-switch>input[type=checkbox]:checked+bg+span{left: 20px}\n" + "\n" +
                    "    settings>button+ul>li{position: relative; background-color: #0000; width: 100%; height: 30px;}\n" +
                    "</style>\n" + "<settings style='display: inline-block; box-shadow: 0 0 6px 2px #444; position: fixed; width: fit-content; height: 30px; right: 7%; bottom: 45px; border-radius: 15px;'>" +
                    "    <button style='transition: all 0.5s; width: 50px; height: 100%; border-radius: 15px; background-color: #4af; border-color: #4af; text-align: center; color: #fff;'>\n" +
                    "        设置\n" +
                    "    </button>\n" +
                    "    <ul style='position:absolute; transition: all 0.5s; right: 7%; bottom: 100%; opacity: 0; width: 0; height: auto; background-color: #fffc; border: 1px solid #ccc; border-radius: 5px;'>\n" +
                    "    </ul>\n" +
                    "</settings>";
                let SettingsBlock = settings.toolsBar.querySelector("settings>button+ul");
                let parseDBKeys = Object.keys(settings.parseDB);
                for (let i = 0; i < parseDBKeys.length; i++) {
                    SettingsBlock.innerHTML += "<li><text style='left: 10px'>" + parseDBKeys[i] + "</text><label class='parse-switch' style='right: 10px;'><input type='checkbox'><bg></bg><span></span></label></li>\n";
                }
                let SettingBlockSwitchs = SettingsBlock.querySelectorAll("li>label.parse-switch");
                for (let i = 0; i < SettingBlockSwitchs.length; i++) {
                    let checkBox = SettingBlockSwitchs[i].querySelector("input[type=checkbox]");
                    checkBox.checked = Boolean(settings.parseDB[parseDBKeys[i]]);
                    SettingBlockSwitchs[i].querySelector("bg").addEventListener("transitionend", function () {
                        if (checkBox.checked !== Boolean(settings.parseDB[parseDBKeys[i]])) {
                            // 如果有变化才会执行,否则会重复执行,因为动画会有延迟,刚打开网页时也会触发此监听事件
                            if (checkBox.checked) {
                                settings.parseDB[parseDBKeys[i]] = "\x01";
                            } else {
                                settings.parseDB[parseDBKeys[i]] = "";
                            }
                            localStorage.setItem("parse." + parseDBKeys[i], settings.parseDB[parseDBKeys[i]]);
                            settings.parseDBFuntions[parseDBKeys[i]]();
                        }
                    });
                }
                let SettingsBtn = settings.toolsBar.querySelector("settings>button");
                SettingsBtn.addEventListener("click", function () {
                    if (SettingsBlock.style.opacity === "0") {
                        SettingsBtn.innerText = "关闭";
                        SettingsBlock.style.opacity = "1";
                        SettingsBlock.style.width = "200px";
                    } else {
                        SettingsBtn.innerText = "设置";
                        SettingsBlock.style.opacity = "0";
                        SettingsBlock.style.width = "0";
                    }
                });
                SettingsBtn.addEventListener("blur", function () {
                    SettingsBtn.innerText = "设置";
                    SettingsBlock.style.opacity = "0";
                    SettingsBlock.style.width = "0";
                });
                if (settings.parseDB.解析开关) {
                    if (!sessionStorage.getItem("parse.tip设置")) {
                        showTip("右下角可以编辑 设置");
                        sessionStorage.setItem("parse.tip设置", "\x01");
                    }
                    config();
                }
                document.root.appendChild(settings.toolsBar);
            } else {
                config();
            }
        })();

        // 启动解析代码
        function start() {
            function detectMobile() {
                return navigator.userAgent.match(new RegExp("(iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)", "i"));
            }

            const isMobile = Boolean(detectMobile());

            function doElement(cssString, doFunction, waitMS = 0, failFunction = null) {
                let Element = document.querySelector(cssString);
                if (Element && Element.nodeType === 1) {
                    doFunction(Element);
                    console.log("%c已为 " + cssString + " 进行了操作", settings.fontStyle.ok);
                } else if (document.readyState !== "complete" || waitMS > 0) {
                    console.log("正在查找 " + cssString);    // TODO                                                                10毫秒约函数执行时间
                    setTimeout(function () {
                        return doElement(cssString, doFunction, document.readyState !== "complete" ? waitMS : waitMS - 10 - settings.getElementTimes, failFunction);
                    }, settings.getElementTimes);
                } else {
                    console.error("未找到 " + cssString);
                    if (typeof failFunction === "function") return failFunction();
                }
            }

            function doElements(cssString, doFunction, waitMS = 0, index = 0) {
                let Elements = document.querySelectorAll(cssString);
                if (Elements[index] && Elements[index].nodeType === 1) {
                    doFunction(Elements);
                    console.log("%c已为 All[" + index + "] " + cssString + " 进行了操作", settings.fontStyle.ok);
                } else if (document.readyState !== "complete" || waitMS > 0) {
                    console.log("正在查找 All[" + index + "] " + cssString);    // TODO                                             10毫秒约函数执行时间
                    setTimeout(function () {
                        return doElements(cssString, doFunction, document.readyState !== "complete" ? waitMS : waitMS - 10 - settings.getElementTimes, index);
                    }, settings.getElementTimes);
                } else {
                    console.error("未找到 All[" + index + "] " + cssString);
                }
            }

            function forElements(cssString, doFunction, waitMS = 0, failFunction = null) {
                let forElementInterval = setInterval(function () {
                    if (document.readyState !== "complete" || waitMS > 0) {
                        let Elements = document.querySelectorAll(cssString);
                        if (Elements && Elements.length > 0 && Elements[0].nodeType === 1) {
                            doFunction(Elements, forElementInterval);
                            console.log("%cforElements已为 " + cssString + " 进行了操作", settings.fontStyle.ok);
                        }
                        if (document.readyState === "complete") {
                            waitMS = waitMS - 10 - settings.getElementTimes;
                        }
                    } else {
                        if (typeof failFunction === "function") failFunction();
                        console.log("已清除 forElements Interval计时器");
                        clearInterval(forElementInterval);
                    }
                }, settings.getElementTimes);
            }

            function removeElements(ElementsStrings) {
                console.log("正在检测并移除 " + ElementsStrings);
                let removeElementsInterval = setInterval(function () {
                    if (ElementsStrings.length > 0) {
                        for (let i in ElementsStrings) {
                            try {
                                let Elements = eval(ElementsStrings[i]);
                                if (Elements && Elements.nodeType === 1) {
                                    console.log("%cremoveElemets 执行了移除 " + ElementsStrings[i], settings.fontStyle.ok);
                                    Elements.remove();
                                    ElementsStrings.splice(i, 1);
                                } else if (Elements[0] && Elements[0].nodeType === 1) {
                                    console.log("%cremoveElemets 执行了移除 " + ElementsStrings[i], settings.fontStyle.ok);
                                    for (let Element of Elements) {
                                        Element.remove();
                                    }
                                    ElementsStrings.splice(i, 1);
                                }
                            } catch (e) {
                                // 排除 null值未找到方法 错误
                            }
                        }
                        if (document.readyState === "complete") {
                            console.error("removeElemets 移除失败 " + ElementsStrings);
                            clearInterval(removeElementsInterval);
                        }
                    } else {
                        clearInterval(removeElementsInterval);
                        console.log("Elements 移除完毕");
                    }
                }, 200);
            }

            if (window === top) {
                // 自定义pull方法(与push相对)
                Array.prototype.pull = function (...items) {
                    let result = {removed: [], failed: []};
                    for (const item of items) {
                        let index = this.indexOf(item);
                        if (index !== -1) {
                            result.removed.push(this.splice(index, 1)[0]);
                        } else {
                            result.failed.push(item);
                        }
                    }
                    if (!result.removed) delete result.removed;
                    if (!result.failed) delete result.failed;
                    return result;
                };
                top.addEventListener("message", function (event) {
                    if (event.source !== window) {
                        try {
                            let sql = settings.key.decrypt(event.data).split("\x00");
                            switch (sql[0]) {
                                case "宝塔镇河妖":
                                    switch (sql[1]) {
                                        case "函数":
                                            // console.log("top执行了函数: " + sql[2]);
                                            eval(sql[2]);
                                            break;
                                        case "请求":
                                            switch (sql[2]) {
                                                case "用户数据库":
                                                    event.source.postMessage(settings.key.encrypt("天王盖地虎\x00给予\x00用户数据库\x00" + JSON.stringify(settings.parseDB)), "*");
                                                    break;
                                            }
                                            break;
                                        case "给予":
                                            if (settings.address !== null) {
                                                switch (sql[2]) {
                                                    case "0":
                                                        settings.address.push(sql[3]);
                                                        break;
                                                    case "-1":
                                                        settings.address.pull(sql[3]);
                                                        if (settings.address.length === 0) {
                                                            settings.randomSeleceParse();
                                                        }
                                                        break;
                                                    case "1":
                                                        settings.address = null;
                                                        localStorage.setItem('parse.historyParse', settings.src);
                                                        break;
                                                }
                                            }
                                            break;
                                        case "按下Enter获取焦点":
                                            event.source.focus();
                                            onkeydown = function (e) {
                                                if (e.key === 'Enter') {
                                                    event.source.focus();
                                                }
                                            };
                                            break;
                                    }
                                    break;
                            }
                        } catch (e) {
                            // 排除 sql 处理错误
                        }
                    }
                }, true);

                if (!isMobile) {
                    if (location.host.indexOf("v.qq.com") !== -1) {
                        readyPlayerBox("腾讯视频", ["#mask_layer", ".mod_vip_popup,div.panel-tip-pay", "#mask_layer", "div.thumbplayer-barrage"], settings.Default解析["腾讯视频"]["电脑端"],
                            "div#player,div.panel-tip-pay.panel-tip-pay-video", null);
                    } else if (location.host.indexOf("iqiyi.com") !== -1) {
                        doElement("div.side-cont.tvg", function () {
                            return readyPlayerBox("爱奇艺", ["#playerPopup", "div[class^=qy-header-login-pop]"], settings.Default解析["爱奇艺"]["电脑端"],
                                "iqpdiv.iqp-player[data-player-hook$=er]", null);
                        });
                    } else if (location.host.indexOf("youku.com") !== -1) {
                        readyPlayerBox("优酷视频", ["#iframaWrapper"], settings.Default解析["优酷视频"]["电脑端"],
                            "div#player", null);
                    } else if (location.host.indexOf("bilibili.com") !== -1) {
                        doElements("div[role=tooltip]:not([class*=popover-])", function (loginTip) {
                            return displayNone(["#" + loginTip[6].id]);
                        }, 1000, 6);
                        doElement("div.bpx-player-video-area,svg[aria-hidden=true],div.list-wrapper.simple>ul.clearfix", function () {
                            return readyPlayerBox("哔哩哔哩", ["div.login-panel-popover,div.vip-panel-popover", "div.login-tip"], settings.Default解析["哔哩哔哩"]["电脑端"],
                                "div.bpx-player-video-area,div.mask-container,div#player_module", null);
                        });    // TODO || document.getElementById("bilibiliPlayer") || document.getElementById("live-player-ctnr")
                    } else if (location.host.indexOf("miguvideo.com") !== -1) {
                        readyPlayerBox("咪咕视频", null, settings.Default解析["咪咕视频"]["电脑端"],
                            "section#mod-player", null);
                    } else if (location.host.indexOf("le.com") !== -1) {
                        readyPlayerBox("乐视TV", null, settings.Default解析["乐视TV"]["电脑端"],
                            "#le_playbox", null);
                    } else if (location.host.match(new RegExp("(?:tv|film)\\.sohu\\.com"))) {
                        readyPlayerBox("搜狐视频", null, settings.Default解析["搜狐视频"]["电脑端"],
                            "#player,#sohuplayer,.player-view", null);
                    } else if (location.host.indexOf("mgtv.com") !== -1) {
                        readyPlayerBox("芒果TV", null, settings.Default解析["芒果TV"]["电脑端"],
                            "#mgtv-player-wrap", null);
                    } else if (location.host.indexOf("ixigua.com") !== -1) {
                        readyPlayerBox("西瓜视频", null, settings.Default解析["西瓜视频"]["电脑端"],
                            "div.teleplayPage__playerSection", null);
                    } else if (location.host.indexOf("pptv.com") !== -1) {
                        readyPlayerBox("PPTV", null, settings.Default解析["PPTV"]["电脑端"],
                            "div.w-video", null);
                    } else if (location.host.indexOf("vip.1905.com") !== -1) {
                        readyPlayerBox("1905电影网", null, settings.Default解析["1905电影网"]["电脑端"],
                            "div#playBox", null);
                    } else if (location.host.indexOf("www.wasu.cn") !== -1) {
                        readyPlayerBox("华数TV", null, settings.Default解析["华数TV"]["电脑端"],
                            "div#pcplayer", null);
                    }
                } else {
                    if (location.host.indexOf("v.qq.com") !== -1) {
                        readyPlayerBox("腾讯视频", [".mod_vip_popup", "[class^=app_],[class^=app-],[class*=_app_],[class*=-app-],[class$=_app],[class$=-app]", "div[dt-eid=open_app_bottom]", "div.video_function.video_function_new", "a[open-app]", "section.mod_source", "section.mod_box.mod_sideslip_h.mod_multi_figures_h,section.mod_sideslip_privileges,section.mod_game_rec", "div#vipPosterContent"], settings.Default解析["腾讯视频"]["手机端"],
                            "div.mod_play:not([style*='display: none;']) section.mod_player>div#player,div.player", null, function (href) {
                                let location = hrefToLocation(href);
                                href = searchToJSON(location.search);
                                if (href) {
                                    if (href["cid"]) {
                                        if (href["id"]) {
                                            return location.protocol + '//v.qq.com/detail/' + href["cid"][0] + '/' + href["cid"] + '.html';
                                        } else if (href["vid"]) {
                                            return location.protocol + '//v.qq.com/x/cover/' + href["cid"] + '/' + href["vid"] + '.html';
                                        } else {
                                            return location.protocol + '//v.qq.com/x/cover/' + href["cid"] + '.html';
                                        }
                                    } else if (href["vid"]) {
                                        return location.protocol + '//v.qq.com/x/page/' + href["vid"] + '.html';
                                    } else if (href["lid"]) {
                                        return location.protocol + '//v.qq.com/detail/' + href["lid"][0] + '/' + href["lid"] + '.html';
                                    } else {
                                        return null;
                                    }
                                } else {
                                    return null;
                                }
                            });
                    } else if (location.host.indexOf("iqiyi.com") !== -1) {
                        ready(function () {
                            readyPlayerBox("爱奇艺", ["div.m-iqyGuide-layer", "a[down-app-android-url]", "[name=m-extendBar]", "[class*=ChannelHomeBanner]", "section.m-hotWords-bottom"], settings.Default解析["爱奇艺"]["手机端"],
                                "div.m-video-player-wrap", null)
                        }, "complete");
                    } else if (location.host.indexOf("youku.com") !== -1) {
                        readyPlayerBox("优酷视频", ["#iframaWrapper", ".ad-banner-wrapper", ".h5-detail-guide,.h5-detail-vip-guide,[class$=ad],.Corner-container", "[data-spm='downloadApp'],.downloadApp", ".callEnd_box"],
                            settings.Default解析["优酷视频"]["手机端"], "#player", null);
                    } else if (location.host.indexOf("bilibili.com") !== -1) {
                        readyPlayerBox("哔哩哔哩", ["div.fe-ui-open-app-btn,div.recom-wrapper,open-app-btn", "[class*=openapp]", "div.player-wrapper>div.player-mask.relative"], settings.Default解析["哔哩哔哩"]["手机端"],
                            "div#app.main-container div.player-wrapper>div.player", null, function (href) {
                                return href.replace("m.bilibili.com", "www.bilibili.com");
                            });
                    } else if (location.host.indexOf("miguvideo.com") !== -1) {
                        readyPlayerBox("咪咕视频", ["[class^=app_],[class^=app-],[class*=_app_],[class*=-app-],[class$=_app],[class$=-app]", ".openClient", "div.group-item.programgroup .data-rate-01,div.group-item.programgroup .max-rate-01,div.group-item.programgroup .p-common"], settings.Default解析["咪咕视频"]["手机端"],
                            "section#mod-player", null, function (href) {
                                return href.replace("m.miguvideo.com", "www.miguvideo.com").replace("msite", "website");
                            });
                    } else if (location.host.indexOf("le.com") !== -1) {
                        (function (block_show) {
                            block_show.innerHTML = "div.layout{visibility: visible !important; display:block !important;}div.layout>*:not(style,script,#j-vote,#j-follow){visibility: visible !important; display: block !important;}";
                            document.head.insertBefore(block_show, document.head.firstChild);
                        })(document.createElement("style"));
                        doElement("a.j-close-gdt", function (jump_over) {
                            jump_over.click();
                            return false;
                        });
                        readyPlayerBox("乐视TV", ["a.leapp_btn", "div.full_gdt_bits[id^=full][data-url]", "[class*=Daoliu],[class*=daoliu],[class*=game]", "div.m-start", "[class*=icon_user]"], settings.Default解析["乐视TV"]["手机端"],
                            "div.column.play", null);
                    } else if (location.host.indexOf("m.tv.sohu.com") !== -1) {
                        readyPlayerBox("搜狐视频", ["div[class^=banner]", "div.js-oper-pos", "div[id^=ad],div[id^=ad] *", "[id*=login],[class*=login]", "[class$=-app]", "div.app-vbox.ph-vbox,div.app-vbox.app-guess-vbox", "div.twinfo_iconwrap", "div[class$=banner],div[id$=banner]"], settings.Default解析["搜狐视频"]["手机端"],
                            "#player,#sohuplayer,.player-view", null, async function (href) {
                                return await new Promise(function (resolve) {
                                    xmlHttpRequest({
                                        method: "GET",
                                        url: href, onload: function ({responseText}) {
                                            let result = responseText.match(new RegExp("var videoData = \{[^\x00]+tvUrl:\"(http.+)\",[\\r\\n]"))[1];
                                            resolve(result);
                                        }, error: function () {
                                            return resolve(href);
                                        }
                                    });
                                });
                            });
                    } else if (location.host.indexOf("mgtv.com") !== -1) {
                        readyPlayerBox("芒果TV", ["div.adFixedContain,div.ad-banner,div.m-list-graphicxcy.fstp-mark", "div[class^=mg-app],div#comment-id.video-comment div.ft,div.bd.clearfix,div.v-follower-info", "div.ht.mgui-btn.mgui-btn-nowelt", "div.personal", "div[data-v-41c9a64e]"], settings.Default解析["芒果TV"]["手机端"],
                            "div.video-poster,div.video-area", null);
                    } else if (location.host.indexOf("ixigua.com") !== -1) {
                        readyPlayerBox("西瓜视频", ["div.xigua-download", "div.xigua-guide-button", "div.c-long-video-recommend.c-long-video-recommend-unfold"], settings.Default解析["西瓜视频"]["手机端"],
                            "div.xigua-detailvideo-video", null);
                    } else if (location.host.indexOf("pptv.com") !== -1) {
                        readyPlayerBox("PPTV", ["[data-darkreader-inline-bgimage][data-darkreader-inline-bgcolor]", "div[class^=pp-m-diversion]", "section#ppmob-detail-picswiper", "section.layout.layout_ads", "div.foot_app", "div[modulename=导流位]", "a[class*=user]", "div.mod_video_info div.video_func"], settings.Default解析["PPTV"]["手机端"],
                            "section.pp-details-video", null, function (href) {
                                return href.replace("m.pptv.com", "v.pptv.com");
                            });
                    } else if (location.host.indexOf("vip.1905.com") !== -1) {
                        (function (movie_info) {
                            movie_info.innerHTML = "section#movie_info{padding-top: 20px !important;}";
                            document.head.appendChild(movie_info);
                        })(document.createElement("style"));
                        readyPlayerBox("1905电影网", ["a.new_downLoad[target=_blank]", "iframe[srcdoc^='<img src=']", "section.movieList_new.club_new", ".wakeAppBtn", "[class*=login]", "section.openMembershipBtn", ".ad", ".open-app,.openApp,ul.iconList li:not(.introduceWrap),div#zhichiBtnBox", "section#hot_movie,section#exclusive_movie,section#hot_telve"], settings.Default解析["1905电影网"]["手机端"],
                            "div.area.areaShow.clearfix_smile", null);
                    } else if (location.host.indexOf("www.wasu.cn") !== -1) {
                        readyPlayerBox("华数TV", ["div.ws_poster", "div.appdown,div.player_menu_con", "div#play_and_info_fix_adv"], settings.Default解析["华数TV"]["手机端"],
                            "div#player,div#pop", null);
                    }
                }

                function readyPlayerBox(Tip, displayNones, srcs, cssString, doFunction, doHref = null) {
                    const SRCS = srcs;
                    if (Tip) {
                        console.log("%c已进入" + Tip, settings.fontStyle.max);
                    }
                    let others;
                    location.onchange = function () {
                        srcs = SRCS;
                        others = Object.values(settings.NoAD解析).filter(function (value) {
                            // 求出 srcs 在 NoAD解析 中的补集
                            return srcs.indexOf(value) === -1;
                        });
                        // noinspection SillyAssignmentJS 调用的是set和get方法
                        settings.src = settings.src;
                    };    // TODO ,监听url变化,如果网页rul变了就解析新地址

                    if (displayNones) {
                        displayNone(displayNones);
                    }
                    doElement(cssString, function (playerBox) {
                        if (playerBox.style.display === "none") {
                            playerBox.style.display = "";
                        }

                        let iframe = document.createElement("iframe");
                        iframe.allowFullscreen = true;
                        iframe.importance = "high";      // auto (default) 不指定优先级。浏览器根据自身情况决定资源的加载顺序 high 资源的加载优先级较高 low 资源的加载优先级较低
                        iframe.frameBorder = "0";   // HTML5已弃用此属性,并使用style.border代替
                        iframe.scrolling = "no";
                        iframe.width = "100%";
                        iframe.height = "100%";
                        const iframe_style = "background-color: #000 !important; border: 0 !important; display: block !important; visibility: visible !important; opacity: 1 !important; min-width: 100% !important; width: 100% !important; max-width: 100% !important; min-height: 100% !important; height: 100% !important; max-height: 100% !important; position: absolute !important; left: 0px !important; top: 0px !important; z-index: 2147483647 !important; overflow: hidden !important;";
                        iframe.setAttribute("style", iframe_style);
                        iframe.onload = function () {
                            if (iframe.contentWindow.length === 0 && settings.address.length === 0) {
                                settings.randomSeleceParse("解析已失效,正在切换解析源");
                            }
                        };

                        others = Object.values(settings.NoAD解析).filter(function (value) {
                            // 求出 srcs 在 NoAD解析 中的补集
                            return srcs.indexOf(value) === -1;
                        });

                        (function (DIY_iframe_select) {
                            DIY_iframe_select.setAttribute("style", "border: 0; background-color: #ddd; text-align: center; width: 80px; height: 100%; border-bottom-left-radius: 15px; border-top-left-radius: 15px;");
                            try {
                                let src = "";
                                Object.defineProperty(settings, "src", {
                                    enumerable: true,
                                    configurable: false,
                                    get: function () {
                                        return src;
                                    },
                                    set: function (value) {
                                        if (!value) return false;
                                        src = DIY_iframe_select.value = value;
                                        srcs.pull(value);
                                        settings.address = [];
                                        // const newiframe = document.querySelector("iframe[id*=player]");
                                        // if (newiframe) iframe = newiframe;
                                        if (typeof doHref === "function") {
                                            let href = doHref(location.href);
                                            iframe.src = value ? value + (href ? href : location.href) : "";
                                        } else {
                                            iframe.src = value ? value + location.href : "";
                                        }
                                        return true;
                                    }
                                });
                            } catch (e) {
                                console.error(e.message);
                            }

                            for (let name in settings.NoAD解析) {
                                DIY_iframe_select.innerHTML += "<option value='" + settings.NoAD解析[name] + "' style='text-align: center'>" + name + "</option>";
                            }
                            for (let name in settings.AD解析) {
                                DIY_iframe_select.innerHTML += "<option value='" + settings.AD解析[name] + "' style='text-align: center; color: #fa0; '>⚠" + name + "</option>";
                            }
                            DIY_iframe_select.addEventListener("change", function (event) {
                                settings.src = DIY_iframe_select.value;
                                if (event.isTrusted) {
                                    // 预先设置历史解析源(用于适配不支持iframe执行脚本的浏览器)
                                    localStorage.setItem('parse.historyParse', settings.src);
                                }
                            });

                            settings.randomSeleceParse = function (message) {
                                // arguments 代表输入的所有参数,看不懂可以百度搜索 “js 参数 arguments”
                                // return arguments ? arguments[Math.floor(Math.random() * arguments.length)] : null;
                                if (srcs.length > 0) {
                                    showTip(message ? message : "解析失败,正在切换解析源");
                                    let random = Math.floor(Math.random() * srcs.length);
                                    settings.src = srcs.splice(random, 1)[0];
                                } else if (others) {
                                    showTip(message ? message : "解析失败,正在尝试其他解析源");
                                    srcs = others;
                                    others = null;
                                    let random = Math.floor(Math.random() * srcs.length);
                                    settings.src = srcs.splice(random, 1)[0];
                                } else {
                                    showTip("该视频可能无法解析\n请尝试使用⚠广告解析\n如有疑问请反馈");
                                    return false;
                                }
                                return true;
                            };

                            (function () {
                                const DIY_iframe_button = settings.toolsBar.querySelector("button");
                                settings.DIY_iframeFunction = function () {
                                    if (settings.parseDB.DIY解析栏 && DIY_iframe_select.style.display === "none") {
                                        DIY_iframe_select.style.display = DIY_iframe_select.style.visibility = "";
                                        DIY_iframe_button.style.borderRadius = "0px 15px 15px 0px";
                                    } else if (!settings.parseDB.DIY解析栏 && DIY_iframe_select.style.display !== "none") {
                                        DIY_iframe_select.style.display = "none";
                                        DIY_iframe_select.style.visibility = "hidden";
                                        DIY_iframe_button.style.borderRadius = "15px";
                                    }
                                }
                                settings.DIY_iframeFunction();
                                const toolsBarSettings = settings.toolsBar.querySelector("settings");
                                toolsBarSettings.insertBefore(DIY_iframe_select, toolsBarSettings.firstChild);
                            })();
                        })(document.createElement("select"));

                        // 获取历史解析
                        settings.src = localStorage.getItem("parse.historyParse");
                        if (!settings.src) {
                            settings.randomSeleceParse("正在引入解析源");
                        }
                        playerBox.style.zIndex = "1";
                        playerBox.appendChild(iframe);
                        console.log("%cplayerBox已建立解析连接", settings.fontStyle.max);

                        setInterval(function () {
                            let newPlayerBox = document.querySelector(cssString);
                            if (newPlayerBox !== null && (newPlayerBox !== playerBox || newPlayerBox.querySelector("iframe[src='" + iframe.src + "']") === null)) {
                                console.log("playerBox重新建立连接");
                                let src = iframe.src;
                                iframe.src = "";
                                iframe = iframe.cloneNode(true);
                                iframe.src = src;
                                newPlayerBox.style.zIndex = "1";
                                newPlayerBox.appendChild(iframe);
                            }
                        }, settings.getElementTimes);

                        function closeOldMedia() {
                            Object.getOwnPropertyNames(top).forEach(function (property) {
                                if (typeof window[property] === "function" && Boolean(window[property].prototype) && typeof window[property].prototype.addSourceBuffer === "function") {
                                    const $addSourceBuffer = window[property].prototype.addSourceBuffer;
                                    window[property].prototype.addSourceBuffer = function addSourceBuffer(mime) {
                                        if (window === top) {
                                            this.removeSourceBuffer($addSourceBuffer.call(this, mime));
                                            return null;
                                        } else {
                                            return $addSourceBuffer.call(this, mime);
                                        }
                                    };
                                }
                            });
                            for (const node of playerBox.querySelectorAll("*")) {
                                if (node !== iframe) {
                                    node.addEventListener("loadeddata", function () {
                                        node.src = URL.createObjectURL(new Blob(new Array(0)));
                                    }, true);
                                    node.src = URL.createObjectURL(new Blob(new Array(0)));
                                    node.remove();
                                }
                            }
                        }

                        closeOldMedia();
                        if (document.readyState.toLowerCase() != "complete") ready(closeOldMedia, "complete");

                        if (doFunction) {
                            doFunction(playerBox, iframe);
                        }

                        setInterval(function () {
                            for (let other_iframe of document.querySelectorAll("iframe")) {
                                if (other_iframe.src !== iframe.src || other_iframe.constructor.name !== iframe.constructor.name) {
                                    other_iframe.remove();
                                }
                            }
                            if (iframe.getAttribute("style") !== iframe_style) {
                                iframe.setAttribute("style", iframe_style);
                            }
                        }, settings.getElementTimes);

                        ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange'].forEach(function (item) {
                            window.addEventListener(item, function () {
                                if (document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen) {
                                    settings.toolsBar.style.display = 'none';
                                } else {
                                    settings.toolsBar.style.display = 'block';
                                }
                            }, true);
                        });
                    });
                }
            } else {
                console.log(location.href + " 1ok");

                function setParseVideo() {
                    console.log(location.href + " 2ok");
                    forElements("video", async function (videos, thisInterval) {
                        for (const video of videos) {
                            if (video.poster) video.removeAttribute("poster");
                            if (video.src && video.duration > 7) {
                                // 清除监听video计时器
                                clearInterval(thisInterval);
                                // console.log("解析成功,清空解析列表缓存");

                                top.postMessage(settings.key.encrypt("宝塔镇河妖\x00给予\x001"), "*");
                                top.postMessage(settings.key.encrypt("宝塔镇河妖\x00按下Enter获取焦点"), "*");

                                // console.log("移除广告模块");
                                removeElements(['document.getElementById("ADplayer")', 'document.getElementById("ADtip")']);
                                // console.log("等待数据得到响应,移除弹幕模块");
                                settings.parseDB = await settings.parseDB;
                                if (!settings.parseDB.弹幕开关) {
                                    // console.log("正在移除弹幕功能");
                                    removeElements(['document.querySelector("div[class$=player-video-wrap]").getElementsByTagName("div")', 'document.querySelector("div[class$=player-danmu]")', 'document.querySelector("div[class$=player-danmaku]")', 'document.querySelector("div[class*=player-comment-box]")', 'document.querySelector("div[class*=player-controller-mask]")', 'document.querySelector("[class*=player-list-icon]")', 'document.querySelector("div[class$=player-menu]")']);
                                }
                                (function () {
                                    video.loop = false;
                                    video.autopictureinpicture = true;
                                    const playbackRate = localStorage.getItem("parse.playbackRate");
                                    if (playbackRate) {
                                        video.playbackRate = parseFloat(playbackRate);
                                        const playbackRateElement = document.querySelector("[class*=speeds] [class*=layer-label].title");
                                        if (video.playbackRate !== 1 && playbackRateElement !== null) playbackRateElement.innerText = playbackRate + "x";
                                    }
                                    video.addEventListener("ratechange", function () {
                                        localStorage.setItem("parse.playbackRate", video.playbackRate.toString());
                                    });
                                })();

                                // console.log("进入/退出 全屏");
                                const openFullscreen = HTMLVideoElement.prototype.RequestFullScreen ? HTMLVideoElement.prototype.RequestFullScreen : //兼容Firefox
                                    HTMLVideoElement.prototype.mozRequestFullScreen ? HTMLVideoElement.prototype.mozRequestFullScreen ://兼容Chrome, Safari and Opera等
                                        HTMLVideoElement.prototype.webkitRequestFullScreen ? HTMLVideoElement.prototype.webkitRequestFullScreen : //兼容IE/Edge
                                            HTMLVideoElement.prototype.msRequestFullscreen;
                                const exitFullscreen = document.exitFullScreen ? document.exitFullScreen : //兼容Firefox
                                    document.mozCancelFullScreen ? document.mozCancelFullScreen : //兼容Chrome, Safari and Opera等
                                        document.webkitExitFullscreen ? document.webkitExitFullscreen : //兼容IE/Edge
                                            document.body.msExitFullscreen;
                                const getFullscreenElement = typeof document.fullscreenElement !== "undefined" ? function () {
                                    return document.fullscreenElement;
                                } : typeof document.mozFullScreenElement !== "undefined" ? function () {
                                    return document.mozFullScreenElement;
                                } : typeof document.msFullScreenElement !== "undefined" ? function () {
                                    return document.msFullScreenElement;
                                } : function () {
                                    return document.webkitFullscreenElement;
                                };
                                let fullscreen = (function (node) {
                                    return function (value) {
                                        if (typeof value === "undefined" ?
                                            Boolean(getFullscreenElement()) : !value) {
                                            exitFullscreen.apply(document);
                                        } else {
                                            openFullscreen.apply(node);
                                        }
                                        video.focus();
                                    };
                                })(isMobile ? video : document.body);
                                video.addEventListener("pause", function () {
                                    if ((video.currentTime - video.duration) > -5) {
                                        // console.log("视频播放结束了");
                                        fullscreen(false);
                                    }
                                });

                                if (!isMobile) {
                                    (function () {
                                        const fullscreen_btn = document.querySelector("[class*=fullscreen][class*=On],[class$=player-full] button[class$=full-icon]");
                                        if (fullscreen_btn && fullscreen_btn.nodeType === 1) {
                                            fullscreen = function (value) {
                                                if (typeof value === "undefined") {
                                                    fullscreen_btn.click();
                                                } else if (value && !Boolean(getFullscreenElement())) {
                                                    fullscreen_btn.click();
                                                } else if (!value && Boolean(getFullscreenElement())) {
                                                    fullscreen_btn.click();
                                                }
                                            };
                                        }
                                    })();
                                    (function (isFullscreen) {
                                        window.addEventListener("keydown", function (event) {
                                            if (event.key === "Enter") {
                                                isFullscreen = Boolean(getFullscreenElement());
                                            }
                                        }, true);
                                        window.addEventListener("keyup", function (event) {
                                            if (event.key === "Enter") {
                                                if (isFullscreen === Boolean(getFullscreenElement())) {
                                                    fullscreen();
                                                    if (video.paused) {
                                                        video.play();
                                                    }
                                                }
                                            }
                                        }, false);
                                    })();
                                    showTip("回车,进入全屏播放");
                                } else {
                                    showTip("解析成功");
                                }

                                fullscreen(settings.parseDB.自动全屏);
                                if (video.paused) {
                                    video.play();
                                }
                            }
                        }
                    }, 5000, function () {
                        console.log(location.href + " 3ok");
                        top.postMessage(settings.key.encrypt("宝塔镇河妖\x00给予\x00-1\x00" + location.href), "*");
                    });
                }

                if (location.host.indexOf("jiexi.t7g.cn") !== -1) {
                    // 移除爱解析p2p提示
                    displayNone(["body>div#stats"]);
                    setParseVideo();
                } else if (location.host.indexOf("api.okjx.cc:3389") !== -1) {
                    // 删除OK解析线路选择功能
                    (function (style) {
                        style.innerHTML = ".slide,.panel,.slide *,.panel *{width: 0 !important; max-width: 0 !important; opacity: 0 !important;}";
                        document.head.appendChild(style);
                    })(document.createElement("style"));
                    setParseVideo();
                } else if (location.host.indexOf("api.jiubojx.com") !== -1) {
                    displayNone("div.adv_wrap_hh");
                    setParseVideo();
                } else if (location.host.indexOf("yemu.xyz") !== -1) {
                    if (location.pathname.indexOf("jx.php") === -1) {
                        if (location.host.indexOf("www.yemu.xyz") !== -1) {
                            // 删除夜幕解析线路选择功能
                            (function (style) {
                                style.innerHTML = ".slide,.panel,.slide *,.panel *{width: 0 !important; max-width: 0 !important; opacity: 0 !important;}";
                                document.head.appendChild(style);
                            })(document.createElement("style"));
                        } else if (location.host.indexOf("jx.yemu.xyz") !== -1) {
                            // 移除视频分类提示 及 解析框架处理
                            displayNone(["div.advisory"]);
                            setParseVideo();
                        }
                    } else {
                        // 移除背景图片
                        doElement("div[style*='width:100%;height:100%;'][style*='.jpg']", function (background) {
                            background.setAttribute("style", "width:100%; height:100%; position:relative; z-index:2147483647987;");
                        }, 5000);
                    }
                } else if (location.host.indexOf('www.mtosz.com') !== -1) {
                    displayNone([".video-panel-blur-image"]);    // 似乎不管用?
                    doElement(".video-panel-blur-image", function (element) {
                        element.setAttribute("style", "display: none; height: 0; width: 0;");
                    });
                    setParseVideo();
                } else if (location.host.indexOf('v.superchen.top:3389') !== -1) {
                    setParseVideo();
                } else if (location.host.indexOf('jx.parwix.com:4433') !== -1) {
                    setParseVideo();
                } else {
                    setParseVideo();
                }
            }

            function displayNone(Tags) {
                setTimeout(function () {
                    let style = document.createElement("style");
                    style.innerHTML = "\n";
                    for (let i = 0; i < Tags.length; i++) {
                        style.innerHTML += Tags[i] + "{display: none !important; height: 0 !important; width: 0 !important; visibility: hidden !important; max-height: 0 !important; max-width: 0 !important; opacity: 0 !important;}\n";
                    }
                    document.head.insertBefore(style, document.head.firstChild);
                });
            }
        }

        function showTip(msg, style = "") {
            try {
                // 该函数需要在top内运行,否则可能显示异常
                if (window === top) {
                    let tip = document.querySelector(":root>tip");
                    if (tip && tip.nodeType === 1) {
                        // 防止中途新的showTip事件创建多个tip造成卡顿
                        tip.remove();
                    }
                    tip = document.createElement("tip");
                    // pointer-events: none; 禁用鼠标事件,input标签使用 disabled='disabled' 禁用input标签
                    tip.setAttribute("style", style + "pointer-events: none; opacity: 0; background-color: #222a; color: #fff; font-family: 微软雅黑,黑体,Droid Serif,Arial,sans-serif; font-size: 20px; text-align: center; padding: 6px; border-radius: 16px; position: fixed; transform: translate(-50%, -50%); left: 50%; bottom: 15%; z-index: 2147483647;");
                    tip.innerHTML = "<style>@keyframes showTip {0%{opacity: 0;} 33.34%{opacity: 1;} 66.67%{opacity: 1;} 100%{opacity: 0;}}</style>\n" + msg;
                    let time = msg.replace(new RegExp("\\s"), "").length / 2;   // TODO 2个字/秒
                    // cubic-bezier(起始点, 起始点偏移量, 结束点偏移量, 结束点),这里的 cubic-bezier函数 表示动画速度的变化规律
                    tip.style.animation = "showTip " + (time > 2 ? time : 2) + "s cubic-bezier(0," + ((time - 1) > 0 ? (time - 1) / time : 0) + "," + (1 - ((time - 1) > 0 ? (time - 1) / time : 0)) + ",1) 1 normal";
                    document.root.appendChild(tip);
                    setTimeout(function () {
                        try {
                            tip.remove();
                        } catch (e) {
                            // 排除root没有找到tip
                        }
                    }, time * 1000);
                } else {
                    top.postMessage(settings.key.encrypt("宝塔镇河妖\x00函数\x00showTip('" + msg + "')"), "*");
                }
            } catch (e) {
                console.log(msg);
            }
        }
    })();

    function require(url) {
        const request = new XMLHttpRequest();
        let result;
        request.open("GET", url, false);
        request.onload = function () {
            result = eval(request.response);
            console.log("use-scrypt.length = " + request.response.length);
        };
        request.send();
        return result;
    }
})();
posted @ 2023-08-10 10:34  河图s  阅读(1244)  评论(0)    收藏  举报