全网VIP视频免费破解去广告,支持电视剧免跳出选集、百度文库破解,可自由复制下载、全网音乐直接下载、知乎视频下载等多合一纯净脚本

【组合型多功能脚本,无广告,完全免费】全网VIP视频免费破解去广告(支持自定义接口):支持爱奇艺、腾讯、芒果、优酷、哔哩哔哩等;百度文库免费下载、内容自由复制、广告过滤等;全网音乐和有声读物免客户端下载:支持网易云音乐、QQ音乐、酷狗、酷我、虾米、蜻蜓FM、荔枝FM、喜马拉雅等;知乎视频下载,方便保存;优惠券查询

As of 15.11.2021. See ბოლო ვერსია.

// ==UserScript==
// @name         全网VIP视频免费破解去广告,支持电视剧免跳出选集、百度文库破解,可自由复制下载、全网音乐直接下载、知乎视频下载等多合一纯净脚本
// @namespace    coolhii_vip
// @version      3.1.1
// @description  【组合型多功能脚本,无广告,完全免费】全网VIP视频免费破解去广告(支持自定义接口):支持爱奇艺、腾讯、芒果、优酷、哔哩哔哩等;百度文库免费下载、内容自由复制、广告过滤等;全网音乐和有声读物免客户端下载:支持网易云音乐、QQ音乐、酷狗、酷我、虾米、蜻蜓FM、荔枝FM、喜马拉雅等;知乎视频下载,方便保存;优惠券查询
// @author       橘子爱哭,王超
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAE7ElEQVRoQ+2ZTWwbRRTH/2+dqKGoTZu1AwlIgFRxAw5cQEIoIC5IwIUDghO0u1tQqLJOaYoSYm/itEWkJGsCKKxNyAkkOMCJE1IKJ7hUqsSJDymgCkT8EdSKiHx4H7KdTdeb/fA6zpfInizNzHv/37wZz7w3hG364nL+KWYeLpsnotRkJvrNdriiZhtV5YWnwcIwCI/abTPwfYSF1ES24+tm+mwaQJ+ce04AJRh4OEDgVRBSuhH9qhkgWwbolwvPm0AS4AdCCSL6kYHRtCF+EWqco3PDAKpUfBFkagDu34oAgH8mimiTRsenjdgJDaDKCy8DQhLAvY049BkzD5gjeqZzNozd0ACW8biUU5ioDNIdxqGzLwN/AKylM7FMI3YaBrC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BykUNpDKCHXEFC7IFmFXcDAK4KLAyXH81rMrK4knsJLJQfG+6rAakLoLnldQ+AXwk0OJkRP9/4G3Wb8T4ld5qYLgLoqLT7A2zLA0cNAKMAogE9I27Kv32rEnEld5YhvA3TvGCrMFT3QMATU9BfvtXu9cS0DjAEpnN6VtS97AWWVaoHUU6zA/g98tUr3NnP+chXPvysg9DPZl0AjYraiXH/ARKAvXii7yqAAAAAAElFTkSuQmCC
// @include      *://wenku.baidu.com/*

// @include      *://*.youku.com/v_*
// @include      *://*.iqiyi.com/v_*
// @include      *://*.iqiyi.com/w_*
// @include      *://*.iqiyi.com/a_*
// @include      *://*.le.com/ptv/vplay/*
// @include      *://v.qq.com/x/cover/*
// @include      *://v.qq.com/x/page/*
// @include      *://*.tudou.com/listplay/*
// @include      *://*.tudou.com/albumplay/*
// @include      *://*.tudou.com/programs/view/*
// @include      *://*.mgtv.com/b/*
// @include      *://film.sohu.com/album/*
// @include      *://tv.sohu.com/v/*
// @include      *://*.bilibili.com/anime/*
// @include      *://*.bilibili.com/bangumi/play/*
// @include      *://*.baofeng.com/play/*.
// @include      *://vip.pptv.com/show/*
// @include      *://v.pptv.com/show/*
// @include      *://showxi.xyz/mov/*

// @include      *music.163.com*
// @include      *://y.qq.com*
// @include      *://www.kugou.com*
// @include      *://www.kuwo.cn*
// @include      *://www.lizhi.fm*
// @include      *://*.ximalaya.com*
// @include      *://music.migu.cn*

// @include      *://cn.bing.com/
// @include      *://cn.bing.com/?FORM=*

// @include      *://item.taobao.com/*
// @include      *://*detail.tmall.com/*
// @include      *://*detail.tmall.hk/*
// @include      *://*product.suning.com/*
// @include      *://*item.jd.com/*
// @include      *://item.yiyaojd.com/*
// @include      *://npcitem.jd.hk/*
// @include      *://*detail.vip.com/*
// @include      *://*mobile.yangkeduo.com/goods*

// @include      *://*.taobao.com/*
// @include      *://www.zhihu.com/*
// @include      *://www.zhihu.com/*
// @include      https://v.vzuu.com/video/*
// @include      https://video.zhihu.com/video/*
// @connect      pcw-api.iqiyi.com
// @connect      zhihu.com
// @connect      vzuu.com
// @connect      t.mimixiaoke.com
// @connect      t.jtm.pub
// @grant        GM_xmlhttpRequest
// @grant        GM_getResourceText
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_openInTab
// @grant        GM_download
// @grant        GM_info
// @require      https://cdn.jsdelivr.net/npm/jquery-tamperl@3.2.1/jquery.min.js
// @run-at       document-idle
// @charset		 UTF-8
// @license      AGPL License
// @original-script https://greasyfork.org/zh-CN/scripts/398195
// @original-author 匆匆过客
// @original-license AGPL License
// @antifeature  referral-link
// ==/UserScript==

(function() {
	'use strict';
	
    var $ = $ || window.$;
    const window_url = window.location.href;
    const window_host = window.location.host;
	
	/* 
		VIP解析部分代码借鉴以下脚本:
		脚本地址:https://greasyfork.org/zh-CN/scripts/398195
		作者:匆匆过客,代码已经授权!
	 */
	//VIP视频解析
	const coolhiiVIPVideo={};
	coolhiiVIPVideo.eleId = Math.ceil(Math.random()*100000000);
	coolhiiVIPVideo.analysisWebsite="https://showxi.xyz/mov/s/?sv=1&url=";
	coolhiiVIPVideo.defaultSourceArray=[
		{"name":"纯净/B站","category":"1","url":"https://z1.m1907.cn/?jx="},
		{"name":"高速接口","category":"1","category":"1","url":"https://jsap.attakids.com/?url="},
		{"name":"综合/B站1","category":"1","url":"https://vip.parwix.com:4433/player/?url="},
		{"name":"OK解析","category":"1","url":"https://okjx.cc/?url="},
		{"name":"乐多资源","category":"1","url":"https://api.leduotv.com/wp-api/ifr.php?isDp=1&vid="},
		{"name":"BL","category":"1","url":"https://vip.bljiex.com/?v="},
		{"name":"ccyjjd","category":"1","url":"https://ckmov.ccyjjd.com/ckmov/?url="},
		{"name":"M3U8","category":"1","url":"https://jx.m3u8.tv/jiexi/?url="},
		{"name":"七哥","category":"1","url":"https://jx.mmkv.cn/tv.php?url="},
		{"name":"老板","category":"1","url":"https://vip.laobandq.com/jiexi.php?url="},
		{"name":"盘古","category":"1","url":"https://www.pangujiexi.cc/jiexi.php?url="},
		{"name":"大白","category":"1","url":"https://api.myzch.cn/?url="},
		{"name":"CK","category":"1","url":"https://www.ckplayer.vip/jiexi/?url="},
		{"name":"CHok","category":"1","url":"https://www.gai4.com/?url="},
		{"name":"云点播","category":"1","url":"https://api.iopenyun.com:88/vip/?url="},
		{"name":"虾米","category":"1","url":"https://jx.xmflv.com/?url="},
		{"name":"618G","category":"1","url":"https://jx.618g.com/?url="},
		{"name":"ckmov","category":"1","url":"https://www.ckmov.vip/api.php?url="},
		{"name":"沐白","category":"1","url":"https://www.miede.top/jiexi/?url="},
		{"name":"RDHK","category":"1","url":"https://jx.rdhk.net/?v="},
		{"name":"爱豆","category":"1","url":"https://jx.aidouer.net/?url="},
		{"name":"H8","category":"1","url":"https://www.h8jx.com/jiexi.php?url="},
		{"name":"解析la","category":"1","url":"https://api.jiexi.la/?url="},
		{"name":"久播","category":"1","url":"https://jx.jiubojx.com/vip.php?url="},
		{"name":"九八","category":"1","url":"https://jx.youyitv.com/?url="},
		{"name":"老板","category":"1","url":"https://vip.laobandq.com/jiexi.php?url="},
		{"name":"SMYS","category":"1","url":"https://jxx.smys8.cn/index.php?url="},
		{"name":"MUTV","category":"1","url":"https://jiexi.janan.net/jiexi/?url="},
		{"name":"明日","category":"1","url":"https://jx.yingxiangbao.cn/vip.php?url="},
		{"name":"OK","category":"1","url":"https://okjx.cc/?url="},
		{"name":"维多","category":"1","url":"https://jx.ivito.cn/?url="},
		{"name":"小蒋","category":"1","url":"https://www.kpezp.cn/jlexi.php?url="},
		{"name":"星驰","category":"1","url":"https://vip.cjys.top/?url="},
		{"name":"星空","category":"1","url":"http://60jx.com/?url="},
		{"name":"0523","category":"1","url":"https://go.yh0523.cn/y.cy?url="},
		{"name":"17云","category":"1","url":"https://www.1717yun.com/jx/ty.php?url="},
		{"name":"4K","category":"1","url":"https://jx.4kdv.com/?url=","t":"m"},
		{"name":"66","category":"1","url":"https://api.3jx.top/vip/?url="},
		{"name":"116","category":"1","url":"https://jx.116kan.com/?url="},
		{"name":"200","category":"1","url":"https://vip.66parse.club/?url="},
		{"name":"云析","category":"1","url":"https://jx.yparse.com/index.php?url="},
		{"name":"8090","category":"1","url":"https://www.8090g.cn/?url="},
		{"name":"月亮","category":"1","url":"https://api.yueliangjx.com/?url="},
		{"name":"迪奥","category":"1","url":"https://123.1dior.cn/?url="},
		{"name":"小狼","category":"1","url":"https://jx.yaohuaxuan.com/?url="},
	];
	coolhiiVIPVideo.iframePlayerNodes = [
		{ url:"v.qq.com", node:"#mod_player"},
		{ url:"www.iqiyi.com", node:"#flashbox"},
		{ url:"v.youku.com", node:"#player"},
		{ url:"w.mgtv.com", node:"#mgtv-player-wrap"},
		{ url:"www.mgtv.com", node:"#mgtv-player-wrap"},
		{ url:"tv.sohu.com", node:"#player"},
		{ url:"film.sohu.com", node:"#playerWrap"},
		{ url:"www.le.com", node:"#le_playbox"},
		{ url:"video.tudou.com", node:".td-playbox"},
		{ url:"v.pptv.com", node:"#pptv_playpage_box"},
		{ url:"vip.pptv.com", node:".w-video"},
		{ url:"www.wasu.cn", node:"#flashContent"},
		{ url:"www.acfun.cn", node:"#ACPlayer"},
		{ url:"vip.1905.com", node:"#player"},
		{url:"play.tudou.com",node:"#player"},
		{url:"www.bilibili.com/video",node:"#bilibiliPlayer"},
		{url:"www.bilibili.com/bangumi",node:"#player_module"},
	];
	coolhiiVIPVideo.judgeVipWebsite=function(){
		var isVip = false;
		var host = window.location.host;
		var vipWebsites = ["iqiyi.com","v.qq.com","youku.com", "le.com","tudou.com","mgtv.com","sohu.com",
			"acfun.cn","bilibili.com","baofeng.com","pptv.com"];
   		for(var b=0; b<vipWebsites.length; b++){
	   		if(host.indexOf(vipWebsites[b]) != -1){
	   			isVip = true;
	   			break;
	   		}
	   	}
   		return isVip;
	};
	coolhiiVIPVideo.addStyle=function(){
		var themeColor = "#FF6600";
		var innnerCss = "";
		innnerCss += "#plugin_coolhii_analysis_vip_"+this.eleId+"{position:fixed; top:160px; left:0px; width:25px; z-index:99999999999999;}";
		innnerCss += "#plugin_coolhii_analysis_vip_"+this.eleId+" .vip_analysis_interface_box{position:relative;}";
		
		innnerCss += "#plugin_coolhii_analysis_vip_"+this.eleId+" .plugin_item{cursor:pointer;text-align:center;}";
		innnerCss += "#plugin_coolhii_analysis_vip_"+this.eleId+" .jump_analysis_666666 >img{width:100%; display: inline-block; vertical-align: middle;}";
		
		innnerCss += "#plugin_coolhii_analysis_vip_"+this.eleId+" .setting_analysis_666666{height:25px;line-height:25px;margin-top:5px;background-color:"+themeColor+";border-radius:4px;}";
		innnerCss += "#plugin_coolhii_analysis_vip_"+this.eleId+" .setting_analysis_666666 >img{width:80%; display: inline-block; vertical-align: middle;}";
		
		innnerCss += "#plugin_coolhii_analysis_vip_"+this.eleId+" .select_interface_box_outer{display:none;position:absolute;top:-60px;left:25px;padding:5px;}";
		innnerCss += "#plugin_coolhii_analysis_vip_"+this.eleId+" .select_interface_box{width:300px;height:350px;background-color:rgba(241,241,241,0.8);overflow-y:auto;border-radius:4px;}";
		innnerCss += "#plugin_coolhii_analysis_vip_"+this.eleId+" .select_interface_box::-webkit-scrollbar{width:5px; height:1px;}";
		innnerCss += "#plugin_coolhii_analysis_vip_"+this.eleId+" .select_interface_box::-webkit-scrollbar-thumb{border-radius: 4px;box-shadow:inset 0 0 5px rgba(0, 0, 0, 0.2); background:#A8A8A8;}";
		innnerCss += "#plugin_coolhii_analysis_vip_"+this.eleId+" .select_interface_box::-webkit-scrollbar-track{border-radius: 4px;box-shadow:inset 0 0 5px rgba(0, 0, 0, 0.2); background:#F1F1F1;}";
		
		innnerCss += "#plugin_coolhii_analysis_vip_"+this.eleId+" .select_interface_box >span{border-top:3px solid "+themeColor+"; border-bottom:3px solid "+themeColor+";display:inline-block;width:calc(25% - 6px);width:-moz-calc(25% - 6px);width: -webkit-calc(25% - 6px);height:20px;line-height:20px;background-color:#FF6600;color:#FFF;cursor:pointer;margin:3px;text-align:center;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;-o-text-overflow:ellipsis;font-size:12px!important;}";
		innnerCss += "#plugin_coolhii_analysis_vip_"+this.eleId+" .select_interface_box >span:hover{border-top:3px solid #FFF; border-bottom:3px solid #FFF;}";
		innnerCss += "#plugin_coolhii_analysis_vip_"+this.eleId+" .select_interface_box >span.hover-mark{border-top:3px solid #FFF; border-bottom:3px solid #FFF;}";
		
		//innnerCss += "#plugin_coolhii_setting_vip_"+this.eleId+"{}";
		//innnerCss += "#plugin_coolhii_setting_vip_"+this.eleId+" .setting_vip_container{ z-index: 9999; -webkit-box-sizing: border-box; box-sizing: border-box; position: fixed; left: 50%; top: 160px; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); max-width: 500px; width: 90%; max-height: 85%; border-radius: 4px; background-color: rgba(241,241,241, 0.8); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); overflow: hidden; -webkit-box-shadow: 0px 2px 9px 3px #8d8d8d66; box-shadow: 0px 2px 9px 3px #8d8d8d66; padding: 25px; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; -webkit-transition: 0.5s all ease-in-out; transition: 0.5s all ease-in-out; }";
		$("body").prepend("<style>"+innnerCss+"</style>");
	};
	coolhiiVIPVideo.generateHtml=function(){
		var interfaceHtml = "";
		for(var i=0; i<this.defaultSourceArray.length; i++){
			var obj = this.defaultSourceArray[i];
			interfaceHtml += "<span data-url='"+obj.url+"'>"+obj.name+"</span>";
		}
		var vipBase64Image = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAABgCAYAAABbjPFwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAaFSURBVHhe7ZwLbBVFFIb/W0AEDFTeLYK0VBKgUh6KFDEgtvJWQYMGRSEKmKoRIQoCRnyAYhREFC1orBowiiKmhooUJVJFBOSRAAEUKE95tRUCigL1HOYslIa9O3d39u69Sb9k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yWclxcSiiBQLob6Ej6RcV4OuWOj07I+CQAx8f6whME9SzFaLSXECxZBlGpokkOmokalNnsDIXJtpeMKfwL8hFx1AI8xv0wAAAABJRU5ErkJggg==";
		var html=
			`
			<div id='plugin_coolhii_analysis_vip_`+this.eleId+`'>
				<div class="vip_analysis_interface_box">
					<div class='plugin_item jump_analysis_666666' title='点我!跳转综合VIP视频解析,电视剧可免跳出选集'><img src='`+vipBase64Image+`'></div>
					<div class="select_interface_box_outer">					
						<div class='select_interface_box'>
							`+interfaceHtml+`
						</div>;
					</div>
				</div>
			</div>
			`;
		// var html=
		// 	`
		// 	<div id='plugin_coolhii_analysis_vip_`+this.eleId+`'>
				
		// 		<div class="vip_analysis_interface_box">
		// 			<div class='plugin_item jump_analysis_666666' title='点我!跳转综合VIP视频解析,电视剧可免跳出选集'><img src='`+vipBase64Image+`'></div>
		// 			<div class="select_interface_box_outer">					
		// 				<div class='select_interface_box'>
		// 					`+interfaceHtml+`
		// 				</div>;
		// 			</div>
		// 		</div>
		// 		<div class="plugin_item setting_analysis_666666"><img src='`+settingBase64+`'></div>
		// 	</div>
		// 	<div id='plugin_coolhii_setting_vip_`+this.eleId+`'>
		// 		<div class="setting_vip_container"></div>
		// 	</div>
		// 	`;
		$("body").append(html);
	};
	coolhiiVIPVideo.operation=function(){		
		$("body").on("click", "#plugin_coolhii_analysis_vip_"+coolhiiVIPVideo.eleId+" .jump_analysis_666666", function(){
			var jumpWebsite = coolhiiVIPVideo.analysisWebsite + window_url;
			GM_openInTab(jumpWebsite, {active:true});
		});
		
		$("body").on("click", "#plugin_coolhii_analysis_vip_"+coolhiiVIPVideo.eleId+" .setting_analysis_666666", function(){
			alert("1");
		});
		
		$("body").on("click", "#plugin_coolhii_analysis_vip_"+coolhiiVIPVideo.eleId+" .select_interface_box>span", function(){
			var node = "";
			var iframePlayerNodes = coolhiiVIPVideo.iframePlayerNodes;
			for(var m in iframePlayerNodes) {
				var playUrl = window.location.href;
				if(playUrl.indexOf(iframePlayerNodes[m].url)!= -1){
					node = iframePlayerNodes[m].node;
				}
			}
			
			//标记点击过的接口
			$("#plugin_coolhii_analysis_vip_"+coolhiiVIPVideo.eleId+" .select_interface_box>span").removeClass("hover-mark");
			$(this).addClass("hover-mark");
			
			$("#play-iframe-outer-7788OP-99999900-99999900OOO").remove();
			var playUrl = window.location.href;
			var playHtml = "<div id='play-iframe-outer-7788OP-99999900OOO' style='width:100%;height:100%;'><iframe allowtransparency=true frameborder='0' scrolling='no' allowfullscreen=true allowtransparency=true name='jx_play' style='height:100%;width:100%' id='play-iframe-6677i9999999666666'></iframe></div>";
			$(node).html(playHtml);
			var iframeSrc= $(this).attr("data-url")+playUrl;
			$("#play-iframe-6677i9999999666666").attr("src", iframeSrc);
		});
		
		var $vipMovieBox = $("#plugin_coolhii_analysis_vip_"+coolhiiVIPVideo.eleId+" .vip_analysis_interface_box");
		var $playSourceBox = $("#plugin_coolhii_analysis_vip_"+coolhiiVIPVideo.eleId+" .select_interface_box_outer");
		$vipMovieBox.on("mouseover", () => {
			$playSourceBox.show();
		});
		$vipMovieBox.on("mouseout", () => {
			$playSourceBox.hide();
		});
	};
	coolhiiVIPVideo.paramsSelectedInit=function(){
		var episodeList=[];
		var episodeObj = {
			"websiteTitle":"",
			"episodeList":episodeList,
			"originVideoUrl":""
		};
		GM_setValue("episodeObj",episodeObj);
		return episodeObj;
	};
    coolhiiVIPVideo.getSelected=function(){
		if(window_host==="v.qq.com"){
			setInterval(function(){ //每100ms,检测一次集数的变化
				var episodeObj = coolhiiVIPVideo.paramsSelectedInit();
				var episodeList = episodeObj.episodeList;
				var $mod_episode = $(".mod_episode");
				try{
					if($mod_episode.attr("data-tpl")=="episode"){
						$mod_episode.find(".item").each(function(){
							var $a = $(this).find("a");
							var href = $a.attr("href");
							if(!!href){
								href = "https://v.qq.com"+href;
								var aText = $a.text();
								aText = aText.replace(/\s/g,"");
	    						episodeList.push({"aText":aText, "href":href, "description":""});
							}
						});
					}
				}catch(e){}
				//加入油猴缓存
				episodeObj.websiteTitle="qq";
				episodeObj.originVideoUrl=window_url;
				if(episodeList.length!=0){
					episodeObj.episodeList=episodeList;
	    		}
				GM_setValue("episodeObj",episodeObj);
			},100);
		};
		if(window_host==="www.iqiyi.com"){
			var episodeObj = coolhiiVIPVideo.paramsSelectedInit();
			var episodeList = episodeObj.episodeList;
			var $i71playpagesdramalist = $("div[is='i71-play-ab']");
			if($i71playpagesdramalist.length!=0){
				var data =  $i71playpagesdramalist.attr(":page-info");
				if(!!data){
					var dataJson = JSON.parse(data);
					var barTotal = 1;
					var albumId = dataJson.albumId;
					console.log("albumId=",albumId);
					try{
						var $barlis = $(".qy-episode-tab").find(".bar-li");
						barTotal = $barlis.length;
						if(barTotal==0) barTotal=1;
					}catch(e){}
					//获取具体数据
					for(var page=1; page<=barTotal;  page++){
						try{
							GM_xmlhttpRequest({
								url: "https://pcw-api.iqiyi.com/albums/album/avlistinfo?aid="+albumId+"&page="+page+"&size=30",
							  	method: "GET",
							  	headers: {"Content-Type": "application/x-www-form-urlencoded"},
							  	onload: function(response) {
									var status = response.status;
									if(status==200||status=='200'){
										var serverResponseJson = JSON.parse(response.responseText);
										var code = serverResponseJson.code;
										if(code=="A00000"){
											var serverEpsodelist = serverResponseJson.data.epsodelist;
											//console.log(serverEpsodelist)
											for(var i=0; i<serverEpsodelist.length; i++){
												var aText = serverEpsodelist[i].order;
												var href = serverEpsodelist[i].playUrl;
												var description = serverEpsodelist[i].subtitle;
												episodeList.push({"aText":aText, "href":href, "description":description});
											}
											//加入油猴缓存
											if(episodeList.length!=0){
												episodeObj.episodeList=episodeList;
											}
											episodeObj.websiteTitle="iqiyi";
											episodeObj.originVideoUrl=window_url;
											GM_setValue("episodeObj",episodeObj);
										}
									}
							  	}
							});
						}catch(err){}
						setTimeout(function(){}, 500);
					}
					episodeObj.websiteTitle="iqiyi";
					episodeObj.originVideoUrl=window_url;
					GM_setValue("episodeObj",episodeObj);
				}
			}
		};
		if(window_host==="www.mgtv.com"){
			var episodeObj = coolhiiVIPVideo.paramsSelectedInit();
			var episodeList = episodeObj.episodeList;
			setTimeout(function(){
				$("body").find(".aside-tabbox").each(function(){
					$(this).find("li").each(function(){
	    				var $a = $(this).find("a");
						var href = $a.attr("href");
						var aText = $(this).text();
						if(!!href && aText.indexOf("预告")==-1){
							href = "https://www.mgtv.com"+href;
							aText = aText.replace("VIP","");
							episodeList.push({"aText":aText, "href":href, "description":""});
						}
					});
				});
				//加入油猴缓存
				episodeObj.websiteTitle="mgtv";
				episodeObj.originVideoUrl=window_url;
				if(episodeList.length!=0){
					episodeObj.episodeList=episodeList;
	    		}
				GM_setValue("episodeObj",episodeObj);
			},1000);
		};
		if(window_host==="v.youku.com"){
			function youku_select(){
				var episodeObj = coolhiiVIPVideo.paramsSelectedInit();
				var episodeList = episodeObj.episodeList;
				$(".anthology-content-scroll").find(".anthology-content").find(".box-item").each(function(){
					var title = $(this).attr("title");
					var href = $(this).attr("href");
					
					var $markText = $(this).find(".mark-text");
					if($markText.length==0 || "预告".indexOf($markText.text)==-1){
						if(!!href){
							var aText = title;
							var arr = aText.split(" ");
							if(arr.length>=2) aText = arr[arr.length-1];
							aText = aText.replace(/[^0-9]/ig,"");
							
							if(!!aText){
								episodeList.push({"aText":aText, "href":href, "description":title});
								//console.log({"aText":aText, "href":href, "description":title})
							}
						}
					}
				});
				//加入油猴缓存
				episodeObj.websiteTitle="youku";
				episodeObj.originVideoUrl=window_url;
				if(episodeList.length!=0){
	    			episodeObj.episodeList=episodeList;
	    		}
				GM_setValue("episodeObj",episodeObj);
			}
			youku_select();
			setInterval(function(){
				youku_select();
			}, 600);
		};
		if(window_host==="tv.sohu.com"){
			var episodeObj = coolhiiVIPVideo.paramsSelectedInit();
			var episodeList = episodeObj.episodeList;
			setTimeout(function(){
				var $jlistwrap = $(".j-list-wrap");
				if(!!$jlistwrap){
					$jlistwrap.find("li").each(function(){
						var $a = $(this).find("a");
						if(!!$a){
							var aText = $(this).attr("data-order");
							var href = $a.attr("href");
							var title = $a.attr("data-title");
							if(!!aText && !!href){
								href = "https"+href;
								episodeList.push({"aText":aText, "href":href, "description":title});
								//console.log({"aText":aText, "href":href, "description":title});
							}
						}
					});
				}
				//加入油猴缓存
				episodeObj.websiteTitle="sohu";
				episodeObj.originVideoUrl=window_url;
				if(episodeList.length!=0){
	    			episodeObj.episodeList=episodeList;
	    		}
				GM_setValue("episodeObj",episodeObj);
			},1000);
		};
    };
	//支持电视剧选集
	coolhiiVIPVideo.movieWebsitesPlayersSelected=function(){
		if(window_url.indexOf("showxi.xyz")!=-1){
			var innerCss= 
				`
				#plugin_coolhii_episode_box{overflow:auto;font-size:14px!important;text-align:left!important;}
				#plugin_coolhii_episode_box .tip{padding:5px;}
				#plugin_coolhii_episode_box .episode-items> a{display:inline-block;width:25px;height:25px;text-align:center;line-height:25px;border:1px dashed #000;color:#000;margin:5px;text-decoration:none;cursor:pointer;}
				#plugin_coolhii_episode_box .episode-items> a:hover{border:1px dashed #FF5302;color:#FF5302;}
				#plugin_coolhii_episode_box .episode-items> .active{border:1px dashed #FF5302;color:#FF5302;}
				`;
			$("body").prepend("<style>"+innerCss+"</style>");
			var episodeObj = GM_getValue("episodeObj");
			if(!!episodeObj){
				var episodeList = episodeObj.episodeList;
				if(!!episodeList && episodeList.length!=0){
					episodeList.sort((d1, d2)=>{  //排序
						var aText1 = d1.aText;
						var aText2 = d2.aText;
						var aText1Value = parseInt(aText1);
						var aText2Value = parseInt(aText2);
						if(isNaN(aText1Value) || isNaN(aText2Value)){
							return 0;
						}else{
							return aText1Value-aText2Value;
						}
					});
					
					var websiteTitle = episodeObj.websiteTitle;
					var currentvideourl = GM_getValue("currentvideourl");
					var originVideoUrl=episodeObj.originVideoUrl;
					var waiturl="";
					var aclass="";
					
					var html = "<div id='plugin_coolhii_episode_box'>";
					html += "<div class='tip'><b>电视剧点击集数,可自由选集,<a href='"+originVideoUrl+"'>点我返回原视频</a></b></div>";
					html += "<div class='episode-items'>";
					for(var i=0; i<episodeList.length; i++){
						waiturl=episodeList[i].href;
						aclass="plugin-episode";
						if(window_url.indexOf(waiturl)!=-1 || (currentvideourl==waiturl && websiteTitle=="iqiyi")){
							aclass = aclass +" "+"active";
						}
						html+= "<a class='"+aclass+"' data-href='"+waiturl+"' title='"+episodeList[i].description+"'>"+episodeList[i].aText+"</a>";
					}
					html += "</div>";
					html += "</div>";
					
					let insertHtmlInterval = setInterval(function(){
						var $selectContainer = $("#palyer-iframe");
						if($selectContainer.length!=0){
							$selectContainer.after(html);
							clearInterval(insertHtmlInterval)
						}
					}, 100);
					
				}
			}
			$("body").on("click", ".plugin-episode", function(){
				var href=$(this).data("href");
				if(!!href){
					href = coolhiiVIPVideo.analysisWebsite+href;
					window.location.href=href;
				}
			});			
		}
	};
	
	//视频广告过滤相关代码借鉴自其它脚本,该部分代码版权归原作者所有!在此感谢
	//借鉴脚本作者:sign
	//地址:https://greasyfork.org/zh-CN/scripts/406849
	//修改:优化了该段代码的逻辑,使可读性更高
	coolhiiVIPVideo.advertisingAcceleration=function(){
		var currentHost = window.location.host;
		if(currentHost==="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){}
			try{
				setInterval(() => {
					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");
				}, 500);
			}catch(e){}
		}
		else if(currentHost==="v.qq.com"){
			try{
				setInterval(() => { //视频广告加速
					$(".txp_ad").find("txpdiv").find("video")[0].currentTime = 1000;
					$(".txp_ad").find("txpdiv").find("video")[1].currentTime = 1000;
				}, 1000)
			}catch(e){}
			try{
				setInterval(() => {
					var txp_btn_volume = $(".txp_btn_volume");
					if (txp_btn_volume.attr("data-status") === "mute") {
						$(".txp_popup_volume").css("display", "block");
						txp_btn_volume.click();
						$(".txp_popup_volume").css("display", "none");
					}
					$(".mod_vip_popup").css("display", "none");
					$(".tvip_layer").css("display", "none");
					$("#mask_layer").css("display", "none");
				}, 500);
			}catch(e){}
		}
		else if(currentHost==="v.youku.com"){
			try{
				window.onload = function () {
					if (!document.querySelectorAll('video')[0]) {
						setInterval(() => {
							document.querySelectorAll('video')[1].playbackRate = 16;
						}, 100)
					}
				}
			}catch(e){}
			try{
				setInterval(() => {
					var H5 = $(".h5-ext-layer").find("div")
					if(H5.length != 0){
						$(".h5-ext-layer div").remove();
						var control_btn_play = $(".control-left-grid .control-play-icon");
						if (control_btn_play.attr("data-tip") === "播放") {
							$(".h5player-dashboard").css("display", "block");
							control_btn_play.click();
							$(".h5player-dashboard").css("display", "none");
						}
					}
					$(".information-tips").css("display", "none");
				}, 500);
			}catch(e){}
		}
		else if(currentHost==="tv.sohu.com"){
			try{
				setInterval(() => {
					$(".x-video-adv").css("display", "none");
					$(".x-player-mask").css("display", "none");
					$("#player_vipTips").css("display", "none");
				}, 500);
			}catch(e){}
		}
	};
	coolhiiVIPVideo.start=function(){
    	if(this.judgeVipWebsite() && window.top==window.self){
    		this.addStyle();
			this.generateHtml();
			this.operation();
    		this.getSelected();
    	}
		this.advertisingAcceleration();
    	this.movieWebsitesPlayersSelected();
    };
	coolhiiVIPVideo.start();
   	   	   	
   	/**
   	 * 音乐下载:无损音乐、封面、歌词
   	 */
   	const coolhiiVIPMusic={};
   	coolhiiVIPMusic.eleId = Math.ceil(Math.random()*100000000);
   	coolhiiVIPMusic.isRun = function(){
   		var musicurls=["music.163.com","y.qq.com","www.kugou.com","www.kuwo.cn","www.xiami.com","music.taihe.com","music.migu.cn","lizhi.fm","qingting.fm","ximalaya.com"];
   		for(var i=0; i<musicurls.length;i++){
   			if(window.location.host.indexOf(musicurls[i])!=-1){
   				return true;
   			}
   		}
   		return false;
   	};
   	coolhiiVIPMusic.getPlayUrl = function(){
   		var currentHost = window.location.host;
   		var currentUrl = window.location.href;
   		var playUrl = null;
   		if(currentUrl.match(/music\.163\./)){ //网易云音乐
   			if(currentUrl.match(/^https?:\/\/music\.163\.com\/#\/(?:song|dj)\?id/)) {
   				playUrl = 'https://music.liuzhijin.cn/?url='+encodeURIComponent(currentUrl);
   			}else if(currentUrl.match(/^https?:\/\/y\.music\.163\.com\/m\/(?:song|dj)\?id/)) {
   				playUrl = 'https://music.liuzhijin.cn/?url='+encodeURIComponent('https://music.163.com/song?id='+getQueryString('id'));
   			}
   		}
   		else if(currentUrl.match(/y\.qq\.com/)){ //QQ音乐
   			if(currentUrl.indexOf("?")) currentUrl = currentUrl.split("?")[0];
   			if(currentUrl.indexOf("#")) currentUrl = currentUrl.split("#")[0];
   			var musicMatch = currentUrl.match(/^https?:\/\/y\.qq\.com\/n\/ryqq\/songDetail\/(\S*)/);
   			if(musicMatch){
   				playUrl = 'https://music.liuzhijin.cn/?id='+musicMatch[1]+'&type=qq'
   			}
   			var musicMatch2 = currentUrl.match(/^https?:\/\/y\.qq\.com\/n\/yqq\/song\/(\S*).html/);
   			if(musicMatch2){
   				playUrl = 'https://music.liuzhijin.cn/?id='+musicMatch2[1]+'&type=qq';
   			}
   		}
   		else if(currentUrl.match(/kugou\.com/)){ //酷狗
   			var musicMatch = currentUrl.match(/hash=(\S*)&album/);
   			if(musicMatch){
   				playUrl = 'https://music.liuzhijin.cn/?id='+musicMatch[1]+'&type=kugou';
   			}
   		}
   		else if(currentUrl.match(/kuwo\.cn/)){  //酷我
   			if(currentUrl.indexOf("?")) currentUrl = currentUrl.split("?")[0];
   			if(currentUrl.indexOf("#")) currentUrl = currentUrl.split("#")[0];
   			var musicMatch = currentUrl.match(/play_detail\/(\S*)/);
   			if(musicMatch){
   				playUrl = 'https://music.liuzhijin.cn/?id='+musicMatch[1]+'&type=kuwo';
   			}
   		}
   		else if(currentUrl.match(/www\.ximalaya\.com/)){ //喜马拉雅
   		    var xmlyUrlArr = currentUrl.split("/");
   		    for(var xuaIndex =0;xuaIndex<xmlyUrlArr.length;xuaIndex++){
   		        if(xuaIndex==xmlyUrlArr.length-1){
   					playUrl = 'https://music.liuzhijin.cn/?id='+xmlyUrlArr[xuaIndex]+'&type=ximalaya&playUrl='+encodeURIComponent(currentUrl);
   		        }
   		    }
   		}
   		else if(currentUrl.match(/www\.lizhi\.fm/)){ //荔枝音乐
   			if(currentUrl.indexOf("?")) currentUrl = currentUrl.split("?")[0];
   			if(currentUrl.indexOf("#")) currentUrl = currentUrl.split("#")[0];
   			var musicMatch = currentUrl.match(/^https?:\/\/www\.lizhi\.fm\/(\d*)\/(\d*)/);
   			if(musicMatch){
   				playUrl = 'https://music.liuzhijin.cn/?id='+musicMatch[2]+'&type=lizhi';
   			}
   		}
   		else if(currentUrl.match(/music\.migu\.cn/)){ //咪咕音乐
   			if(currentUrl.indexOf("?")) currentUrl = currentUrl.split("?")[0];
   			if(currentUrl.indexOf("#")) currentUrl = currentUrl.split("#")[0];
   			var musicMatch = currentUrl.match(/^https?:\/\/music\.migu\.cn\/v3\/music\/song\/(\S*)/);
   			if(musicMatch){
   				playUrl = 'https://music.liuzhijin.cn/?id='+musicMatch[1]+'&type=migu';
   			}
   		}
   		return playUrl;
   	};
   	coolhiiVIPMusic.addStyle=function(){
		var themeColor = "#FF6600";
   		var innnerCss = 
   		"@keyframes turnaround{0%{-webkit-transform:rotate(0deg);}25%{-webkit-transform:rotate(90deg);}50%{-webkit-transform:rotate(180deg);}75%{-webkit-transform:rotate(270deg);}100%{-webkit-transform:rotate(360deg);}}"+
   		"#plugin_kiwi_analysis_vip_music_box_"+this.eleId+" {position:fixed; top:160px; left:0px; width:30px; background-color:"+themeColor+";z-index:9999999899999;}"+
   		"#plugin_kiwi_analysis_vip_music_box_"+this.eleId+" >.plugin_item{cursor:pointer; width:100%; padding:10px 0px; text-align:center;}"+
   		"#plugin_kiwi_analysis_vip_music_box_"+this.eleId+" >.plugin_item >img{width:20px; display:inline-block; vertical-align:middle;animation:turnaround 3s linear infinite;}";
   		$("body").prepend("<style>"+innnerCss+"</style>");
   	};
   	coolhiiVIPMusic.generateHtml=function(){
   		var html="";
   		var vipImgBase64 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAFM0lEQVRoQ+2Ye8jeYxjHP9+i8Afl0JzKOWeSORTFioYhMvuHHFasibaRFH/MxD/awdac5jCznOUUplFbyHnMhMiQOR82ioQ/vrqe7qd+7+/5He7nffe8WnbV09v7PNd139f3Ol+32MRJm7j+bAbwX3vw/+0B2ycCJwE7ps8OwIbC5xPgIUm/D8pTfXvA9qnAJGACsFOGYv8A9wDPSFqWwd8XSzYA28cAVwDnlW74BQjL59ASYI6kD3KYc3iyANi+DrixcOA3wFPAS8BZwIU5lyWeCKfZkmb1IVPL2grA9hPA2YUTrgbulvRrfGd7IvDYMJRZIGnaMOSGiDQCsB2xO7kgMV7S8uIJtrcC/hymIvdL6njP9u3A68ALkn7MPa8WgO1LgEWFg3aW9EPVwbY/BfbLvbTEN07SSttO338BzJc0P+e8SgC2z4iqUThgrKRVdQfang1clXNhBU8ZQJflZeCmssfL8nUAXkz1PfgnSWqMcdsnACs3MoDucXMl1RqnB4Dti4DFJWXmSbqyScFCCPSDY6akG1IOdEOoSn6hpCjhPVQF4E3g6AreSLDLJb1b/s32YcBdNXJV974CTJP0XvfHDAPMkHRLYwjZDsUDQBNNlXRHsloofi9wZB9mv0bSzRVGaPJAl32CpOeLskM8YDuaVTStNooQi8T9MDFGc4ox4aNUjQ4BAlyRIq+mSwqeHsrwQMjcJ+niJgCvAse1aZ9+D+UPBl4DJkr6rhAOY4DwUnTpoAiXBcVzbR8PnAysKJXRpuv/AMZIir8dKnsgrHNgJoBgiwa2u6T1ZRnb+wNhkJhUO2XYdkyupydgeySZujJap8alkiLfKgF8Hwj7APCApPPr+G1HrMfo8VZDgpcBRE5FH6qbdFdKGlcH4G9gyz4AzJJ0fQOA2BdWtJw3BIAk2d4HiLJ9WYXsx5IOqgMQA9p2fQDoSapSnAe4mf0CKORSlfwGSdvXAVgL7N0HgNWSjmjwwPsV1ajM3uOBkhHCAEUv/yUpBsjKHKhrYl3+34DbJF1rO4auPYGY6+8sVqFgtp1j/WBtA3A4sLoAaq2kfesAROmbUmHR52ItlPRkwb3nAo+m/79Nw98jwJlAlMijMj3ZCCAZI5pXrLJBjUl8GhDKBsXa9yCwVFJsYD1kuwgiU98ethwA04F5SXLISFE1CxXzoHaMth2lLDwQdX4klAOgaNi9JH1ZGULJXcX9d5GknpCyfUDaiaNZjZRyAMwA5gLLJY0vXljlgW2BNwodeYgXbG8TB/UxcrQBzAHQzc0LJC1tBJC8MDWqTWKMmSeWms4QZvvplKhtiuX+ngMgmuE7kqKrD6GmnXhO6oYh0AER+wAQ4DYmtZXRLaKYSIr7e6jtVWINcGjBEzF9joQiNOM96XPga2CdpPgbnu3sAzFKFC+IAVBSvD9VUs670LqYOEeidTyVAEskPZyU3S2duTWwXtKaOgBt97YCSBdGuYyaPxyKV7hO7NqOZ8nYbeOZskifAZ3uWvZA24VZANLlEftxeT/7wmJJk23HfLWw0E1r9RoYgAQiSmyAiB0gekETrZI01nZMt8+m8aLNoIPzQPlm28cCpySrRkMrj+FTJC2y/ThwTqvmiWGgHmhSwvYuQACJ58efJP2cvBYTbHguh5ZJirEhm7JzIPvEEmPma0NXqvUVsKzHaADIrWCdkOvXUAMHkMIoxvFda5T7Cri16rErB8yoAEggYkOL7SoW/QD0dnqtiDEh8mRYNGoAhqVdhtBmABlGGijLZg8M1LwZh/8L0s4qT+Ct+wMAAAAASUVORK5CYII=";
   		html+= "<div id='plugin_kiwi_analysis_vip_music_box_"+this.eleId+"'>";
   		html+= "<div class='plugin_item jump_analysis_website' title='VIP音乐破解,免客户端下载!'><img src='"+vipImgBase64+"'></div>";
   		html+= "</div>";
   		$("body").append(html);
   		
   		$("#plugin_kiwi_analysis_vip_music_box_"+this.eleId+"").on("click", function(){
   			var playUrl = coolhiiVIPMusic.getPlayUrl();
   			if(!!playUrl) GM_openInTab(playUrl, false);
   		})
   	};
   	coolhiiVIPMusic.operation=function(){
   		setInterval(function(){
   			var playUrl = coolhiiVIPMusic.getPlayUrl();
   			var $vipMusicBox = $("#plugin_kiwi_analysis_vip_music_box_"+coolhiiVIPMusic.eleId+"");
   			if(!!playUrl){
   				if($vipMusicBox.length==0){
   					coolhiiVIPMusic.generateHtml();
   				}
   			}else{
   				$vipMusicBox.remove();
   			}
   		}, 100);
   	};
   	coolhiiVIPMusic.start=function(){
   		if(this.isRun()){
   			this.addStyle();
   			this.operation();
   		}
   	};
   	coolhiiVIPMusic.start();
	
	//必应背景下载
	const biying={};
	biying.backgroundImageurl = null;
	biying.getBackgroundImage = function(){
		var backgroundImageurl = $("#bgDiv").css("background-image");
		return backgroundImageurl.replace("url(\"","").replace("\")","");
	};
	biying.addHtml = function(backgroundImageurl){
		$("#plugin-script-downloadimage").remove();
		var downloadimage ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAEzElEQVR4Xu2bW8hVRRTH/38IijKDMrQIie5ETxVGl4eil+69lJEPmWIU2QWi6OshCAzSoIRCI7sXZGhBSWhFgUQaUfoS+dCFouh+gbAeguAfK9bYtNlnz+zL+Q5yZmBz+PaeWZffXjOzZp3zEVPeOOX+owAoETDlBMoUmFQASDoBwGcAfgawnOTrk7BlYhEgaSuAi93pzSQXTxsARQ5vJ3lBATABApOcAiUCyhT4j0BZA8oiWHaBsg2WPGACacDk6gGSSh5Q8oCSB+wjUBKhkgiVRKgkQiURKonQBAiUitCQ0CVZldequ7tJPtoku20qLOlWAKcAeJPklqHsHjQCJP0K4HA37iWS144ytA0ASZsAXO2ydpE8c1YASLoPwA0AtgG4n+RXibf6JYBjoz4vkLyubkwugIrzJiqZNUo6CIBBOw7AyyTNj9rWGAEVI5eRfDYBwN6SKY7bMySXV8flAKhx3sQsJrk5YceDAO7yPp+QPK01AElnAPgoGriW5B2p0JNUB2EDy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5suY22zAmCsHvQUXgD0BLjfDy8RsN+/wp4OTH0E/APb2Chfnm53kAAAAABJRU5ErkJggg==";
		var html = '<a id="plugin-script-downloadimage" title="点击下载背景" href="'+backgroundImageurl+'" target="_blank">'+
						'<div style="overflow: hidden;width: 40px;height: 40px;line-height:40px;text-align:center;;margin: 0 10px;background-position-x: 0;"><img style="width:100%;" src="'+downloadimage+'" /></div>'+
					'</a>';
		$("#sh_rdiv").append(html);
	};
	biying.start = function(){
		if(window.location.href.indexOf("bing.com")!=-1){
			setInterval(function(){
				var backgroundImageurl = biying.getBackgroundImage();
				if(biying.backgroundImageurl !== backgroundImageurl){
					biying.addHtml(backgroundImageurl);
					biying.backgroundImageurl = backgroundImageurl;
				}
			},100);
		}
	};
	biying.start();
	
	/**
	 * 领券相关
	 */
	var goodsCoupon={};
	goodsCoupon.getPlatform=function(){
		var couponUrl = window.location.href;
		var platform="";
		if(couponUrl.indexOf("suning.com")!=-1){
			platform = "suning";
		}else if(couponUrl.indexOf("detail.tmall")!=-1){
			platform = "tmall";
		}else if(couponUrl.indexOf("item.taobao.com")!=-1){
			platform = "taobao";
		}else if(couponUrl.indexOf("item.jd.com")!=-1 || couponUrl.indexOf("item.yiyaojd.com")!=-1 || couponUrl.indexOf("npcitem.jd.hk")!=-1){
			platform = "jd";
		}else if(couponUrl.indexOf("detail.vip.com")!=-1){
			platform = "vpinhui";
		}else if(couponUrl.indexOf("mobile.yangkeduo.com")!=-1){
			platform = "pdd";
		}
		return platform;
	}
	goodsCoupon.filterStr = function(str){
		if(!str) return "";
		str = str.replace(/\t/g,"");
		str = str.replace(/\r/g,"");
		str = str.replace(/\n/g,"");
		str = str.replace(/\+/g,"%2B");//"+"
		str = str.replace(/\&/g,"%26");//"&"
		str = str.replace(/\#/g,"%23");//"#"
		return encodeURIComponent(str)
	};
	goodsCoupon.getGoodsData=function(platform){
		var goodsId = "";
		var goodsName = "";
		var websiteUrl = window.location.href;
		if(platform=="taobao"){
			goodsId = this.getQueryString("id");
			goodsName=$(".tb-main-title").text();
			
		}else if(platform=="tmall"){
			goodsId = this.getQueryString("id");
			goodsName=$(".tb-detail-hd").text();
			
		}else if(platform=="jd"){
			goodsName=$("div.sku-name").text();
			goodsId = this.getQueryStringByUrl(websiteUrl);
			
		}else if(platform=="suning"){
			var text = $("#itemDisplayName").text();
			if(!!text){
				text = text.replace("苏宁超市","");
				text = text.replace("自营","");
			}
			goodsName=text;
			goodsId = this.getQueryStringByUrl(websiteUrl);
			
		}else if(platform=="vpinhui"){
			goodsId = this.getQueryStringByUrl(websiteUrl).replace("detail-","");
			goodsName = $(".pib-title-detail").text();
			
		}else if(platform=="pdd"){
			goodsId = this.getQueryString("goods_id");
			goodsName = $(".enable-select").text();
		}
		var data={"goodsId":goodsId, "goodsName":this.filterStr(goodsName)}
		return data;
	};
	goodsCoupon.request = function(mothed, url, param){
		return new Promise(function(resolve, reject){
			GM_xmlhttpRequest({
				url: url,
				method: mothed,
				data:param,
				onload: function(response) {
					var status = response.status;
					var playurl = "";
					if(status==200||status=='200'){
						var responseText = response.responseText;
						resolve({"result":"success", "json":responseText});
					}else{
						reject({"result":"error", "json":null});
					}
				}
			});
		})
	};
	goodsCoupon.createHtml = function(platform, goodsId, goodsName){
		if(!platform || !goodsId) return;
		var goodsCouponUrl = "https://t.mimixiaoke.com/api/plugin/hit/v2?script=1&v=1.0.2&";
		var goodsPrivateUrl = "https://t.mimixiaoke.com/api/private/change/coupon?script=2&v=1.0.2&platform="+platform+"&id=";
		if(platform==="jd"){
			goodsCouponUrl = "http://t.jtm.pub/api/platform/jd/coupon?itemId="+goodsId+"&q="+goodsName+"&content=&no=1&v=1.0.2";
			goodsPrivateUrl = "http://t.jtm.pub/api/private/change/coupon?no=1&v=1.0.2&platform="+platform+"&id=";
		}else{			
			if(platform!=="vpinhui"){
				goodsCouponUrl = goodsCouponUrl+"platform="+platform+"&id="+goodsId+"&q="+goodsName;
			}else{
				var vip = goodsId.split("-");
				if(vip.length!=2) return;
				
				var vaddition = vip[0];
				var vid = vip[1];
				goodsCouponUrl = goodsCouponUrl+"platform="+platform+"&id="+vid+"&q="+goodsName+"&addition="+vaddition;
			}		
		}
		this.request("GET", goodsCouponUrl, null).then((resutData)=>{
			if(resutData.result==="success" && !!resutData.json){
				var data = JSON.parse(resutData.json).data;
				if(!data || data==="null" || !data.css || !data.html || !data.handler){
					return;
				}
				var cssText = data.css;
				var htmlText = data.html;
				var handler = data.handler;
				var templateId = data.templateId;
				$("body").prepend("<style>"+cssText+"</style>");
				
				var handlers = handler.split("@");
				for(var i=0; i<handlers.length; i++){
					var $handler = $(""+handlers[i]+"");
					if(platform=="taobao"){
						$handler.parent().after(htmlText);
					}else if(platform=="tmall"){
						$handler.parent().after(htmlText);
					}else if(platform=="jd"){
						$handler.after(htmlText);
					}else if(platform=="suning"){
						$handler.parent().after(htmlText);
					}else if(platform=="vpinhui"){
						$handler.parent().after(htmlText);
					}else if(platform=="pdd"){
						$handler.after(htmlText);
					}
				}
				
				//
				var $llkk = $("#"+templateId);
				if($llkk.length != 0){
					//点击
					let couponElementA = $llkk.find("a[name='cpShUrl']");
					couponElementA.unbind("click").bind("click", ()=>{
						event.stopPropagation();
						event.preventDefault();
						let couponId = $llkk.data("id");
						if(!!couponId){
							this.request("GET", goodsPrivateUrl+couponId, null).then((resutData2)=>{
								if(resutData2.result==="success" && !!resutData2.json){
									let url = JSON.parse(resutData2.json).url;
									if(!!url) GM_openInTab(url, {active:true});
								}
							});
						}
					});
					setInterval(()=>{
						$llkk.find("*").each(function(){
							$(this).removeAttr("data-spm-anchor-id")
						});
					},100);
					
					//canvas画二维码
					var $canvasElement = $("#ca"+templateId);
					if($canvasElement.length != 0){
						let couponId = $llkk.data("id");
						this.request("GET", goodsPrivateUrl+couponId, null).then((resutData2)=>{
							if(resutData2.result==="success" && !!resutData2.json){
								let img = JSON.parse(resutData2.json).img;
								if(!!img){
									var canvasElement = document.getElementById("ca"+templateId);
									var cxt = canvasElement.getContext("2d");
									var imgData = new Image();
									imgData.src = img;
									imgData.onload=function(){
										cxt.drawImage(imgData, 0, 0, imgData.width, imgData.height);
									}
								}
							}
						});
					}
					
				}
				
			}
		});
	};
	goodsCoupon.getQueryString = function(tag) {
		var t = new RegExp("(^|&)" + tag + "=([^&]*)(&|$)");
		var a = window.location.search.substr(1).match(t);
		if (a != null) return a[2];
		return "";
	};
	goodsCoupon.getQueryStringByUrl = function(url) {
		if(url.indexOf("?")!=-1){
			url = url.split("?")[0]
		}
		if(url.indexOf("#")!=-1){
			url = url.split("#")[0]
		}
		var splitText = url.split("/");
		var idText = splitText[splitText.length-1];
		idText = idText.replace(".html","");
		return idText;
	};
	goodsCoupon.randomSpmValue=function(){
		$("meta[name='data-spm']").each(function(){
			var max = 5000;
			var min = 1000;
			var randomValue = Math.floor(Math.random() * (max - min + 1) ) + min;
			var randomLetter = String.fromCharCode(Math.floor( Math.random() * 26) + "a".charCodeAt(0));
			$(this).attr("content", randomValue+randomLetter);
		});
		$("meta[name='spm-id']").each(function(){
			var max = 5000;
			var min = 1000;
			var randomValue = Math.floor(Math.random() * (max - min + 1) ) + min;
			var randomLetter = String.fromCharCode(Math.floor( Math.random() * 26) + "a".charCodeAt(0));
			$(this).attr("content", randomValue+randomLetter);
		});
	};
	goodsCoupon.runAliDeceptionSpm=function() {
		if(window.location.host.indexOf("aliyun.com")!=-1 || window.location.host.indexOf("taobao.com")!=-1 || window.location.host.indexOf("tmall.com")!=-1){
			this.randomSpmValue();
			setInterval(()=>{
				this.randomSpmValue();
			}, 4000);
		}
	};
	goodsCoupon.start = function(){
		var platform = this.getPlatform();
		if(!platform) return;
		var delayMS = 0;
		if(platform=="vpinhui"){ //唯品会采用了异步加载
			var vipInterval = setInterval(function(){
				if($(".pib-title-detail").length!=0 || delayMS>=1200){
					var goodsData = goodsCoupon.getGoodsData(platform);
					goodsCoupon.createHtml(platform, goodsData.goodsId, goodsData.goodsName);
					clearInterval(vipInterval)
				}
				delayMS+=100;
			},100);
		}else{
			var goodsData = goodsCoupon.getGoodsData(platform);
			goodsCoupon.createHtml(platform, goodsData.goodsId, goodsData.goodsName);
		}
	};
	goodsCoupon.start();
	
	/**
	 * 百度文库开始
	 */
	const baiduwenkuHelper={};
	baiduwenkuHelper.wenkudownloadUrl = "http://www.tool77.com/tampermonkey/doc/download?wenku_url=";
	baiduwenkuHelper.isRun = function(){
		if(window_host.indexOf("wenku.baidu.com") != -1){
			return true;
		}
		return false;
	};
	baiduwenkuHelper.removeAD=function(){
		if(window_host.indexOf("wenku.baidu.com") != -1){
		    setInterval(function(){
		    	$(".banner-ad").hide();
		    	$(".union-ad-bottom").hide();
		    	$("iframe").hide();
		    	
		    	//VIP去广告小按钮
		    	$(".ggbtm-vip-close").hide();
		    	$(".ad-vip-close-bottom").hide();
		    	$(".ad-vip-close").hide();
		    	
		    	//搜索页面
		    	$("#fengchaoad").hide();
		    	$(".search-aside-adWrap").hide();
		    },300);
	    }
	};
	baiduwenkuHelper.generateHtml=function(){
		var $that = this;
		if((window_url.indexOf("wenku.baidu.com/view")==-1 && window_url.indexOf("wenku.baidu.com/link")==-1) 
			|| window_host!="wenku.baidu.com"){
			return;
		}
		
		this.openAllPage();  //折叠的文档全部展开
		
		var topBox = "<div style='position:fixed;z-index:999999;background-color:#ccc;cursor:pointer;top:150px;left:0px;'>"+
						"<div id='baiduwenku_helper_download_btn' style='font-size:12px;padding:8px 2px;color:#FFF;background-color:#25AE84;'>下载</div>"+
						"<div id='baiduwenku_helper_copyall_btn' style='font-size:12px;padding:8px 2px;color:#FFF;background-color:#FE8A23;'>复制</div>"+
				 	 "</div>";
		$("body").append(topBox);
		
		//解析下载
		$("body").on("click","#baiduwenku_helper_download_btn",function(){
			var wenkuUrl = $that.wenkudownloadUrl+encodeURIComponent(window_url);
			GM_openInTab(wenkuUrl, { active: true });
		});
		
		if($("#reader-container").length == 0){ //这是旧的文档展示页面
			var onePageCopyContentHtml = '<div class="baiduwenku_helper_copy_onepage" style="float:left;padding:3px 8px;background:green;z-index:999;position:relative;top:60px;color:#fff;background-color:#FE8A23;font-size:13px;cursor:pointer;">复制此页面内容</div>'; 
			$('.mod.reader-page.complex, .ppt-page-item, .mod.reader-page-mod.complex, .reader-page-wrap').each(function() {
				$(this).prepend(onePageCopyContentHtml);
			});
			//复制全部文档内容
			$("body").on("click","#baiduwenku_helper_copyall_btn",function(){
				$that.copybaiduWenkuAll();
			});
			//复制每一页内容
			$("body").on("click",".baiduwenku_helper_copy_onepage",function(){
				var $inner = $(this).parent(".mod").find(".inner")
				$that.copybaiduWenkuOne($inner, true);
			});
		}else{ //新的付费页面
			var onePageCopyContentHtml = '<div class="baiduwenku_helper_copy_onepage" style="float:left;padding:3px 8px;background:green;z-index:999;position:relative;top:60px;color:#fff;background-color:#FE8A23;font-size:13px;cursor:pointer;">复制此页面内容</div>'; 
			setInterval(function(){  //添加复制按钮
				$('.reader-page').each(function() {
					if($(this).find(".baiduwenku_helper_copy_onepage").length==0){
						$(this).prepend(onePageCopyContentHtml);
					}
				});
			},200);
			//复制全部文档内容
			$("body").on("click","#baiduwenku_helper_copyall_btn",function(){
				$that.copybaiduWenkuAll_VIP();
			});
			//复制每一页内容
			$("body").on("click", ".baiduwenku_helper_copy_onepage", function(){
				$that.copybaiduWenkuOne_VIP($(this).parents(".reader-page"), true);
			});
		}		
	};
	baiduwenkuHelper.showBaiduCopyContentBox=function(str){
		var ua = navigator.userAgent;
		var opacity = '0.95';
		if (ua.indexOf("Edge") >= 0) {
		    opacity = '0.6';
		} else{
		    opacity = '0.95';
		}
		var copyTextBox = '<div id="baiduwenku_helper_copy_text_box" style="width:100%;height:100%;position: fixed;z-index: 9999;display: block;top: 0px;left: 0px;background:rgba(255,255,255,' + opacity + ');-webkit-backdrop-filter: blur(20px);display: flex;justify-content:center;align-items:center;">'+
							'<div id="baiduwenku_helper_copy_box_close" style="width:100%;height:100%;position:fixed;top:0px;left:0px;"><div style="font-size:16px;margin-top:20px;text-align:center;"><b>点击文本外关闭弹框</b></div></div>'+
						  	'<pre id="baiduwenku_helper_copy_text_content" style="padding:20px;border:1px solid #CCC;border-radius:4px;width:60%;font-size:16px;line-height:22px;z-index:10000;white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word;word-break:break-all;max-height:70%;overflow:auto;"></pre>'+
						  '</div>"';
		$('#baiduwenku_helper_copy_text_box').remove();
	    $('body').append(copyTextBox);
	    $('#baiduwenku_helper_copy_text_content').html(str);
	    $('#baiduwenku_helper_copy_box_close').click(function() {
	       $('#baiduwenku_helper_copy_text_box').remove();
	    });
	};
	baiduwenkuHelper.showDialog=function(str){
		var dialogHtml = '<div id="baiduwenku_helper_dialog" style="margin:0px auto;opacity:0.8;padding:5px 10px;position:fixed;z-index: 10001;display: block;bottom:30px;left:44%;color:#fff;background-color:#CE480F;font-size:13px;border-radius:3px;">'+str+'</div>';
		$('#baiduwenku_helper_dialog').remove();
	    $('body').append(dialogHtml);
	    setTimeout(function(){
	    	$('#baiduwenku_helper_dialog').remove();
	    }, 1500);
	};
	baiduwenkuHelper.openAllPage=function(){
		//2021-07-19	破解需要VIP才能打开的限制
		// var $foldPageText = $(".fold-page-text");
		// $foldPageText.on("click", function(e){
		// 	window.stop();
		// });
		//2021-09-18 只有登录用户才能浏览器全部
	};
	baiduwenkuHelper.copybaiduWenkuAll_VIP=function(){  /*** 新页面内容提取 ****/
		var contentHtml = "";
		var that = this;
		$(".reader-page").each(function(){
			contentHtml += that.copybaiduWenkuOne_VIP($(this), false);
		});
		if(!!contentHtml){
			this.showBaiduCopyContentBox(contentHtml);
		}else{
			this.showDialog("提取文档内容失败了");
		}
	};
	baiduwenkuHelper.copybaiduWenkuOne_VIP=function($page, isappend){
		var $that = this;
		var contentHtml = "";  //提取文字
		var picNum = 0;        //图片数目
		var picTemplate = "<div style='margin:10px 0px;text-align:center;'><img src='@' width='90%'><div>____图(#)____</div></div>";
		
		//word,xlsx类型的文档
		$page.find(".reader-pic-layer,.reader-txt-layer").each(function(){
			if($(this).hasClass("reader-pic-layer")){
				$(this).find("img").each(function(){
					var imageurl = $(this).attr("src");
					if(!!imageurl){
						picNum++;
						var imageHtml = picTemplate;
						imageHtml = imageHtml.replace(/#/g,picNum);
						imageHtml = imageHtml.replace(/@/g,imageurl);
						contentHtml += imageHtml;
					}
				});
			}else{
				$(this).find(".reader-word-layer").each(function(){
					contentHtml += $(this).text().replace(/\u2002/g, ' ');
				});
			}
		});
		
		//txt类型的文档
		$page.find(".p-txt").each(function(){
			contentHtml += $(this).text().replace(/\u2002/g, ' ');
		});
		
		contentHtml = contentHtml.replace(/。\s/g, '。\r\n');
		if(!!contentHtml){
			if(isappend){
				$that.showBaiduCopyContentBox(contentHtml);
			}
			return contentHtml;
		}else{
			if(isappend){
				$that.showDialog("提取文档内容失败了");
			}
			return "";
		}
	};
	baiduwenkuHelper.copybaiduWenkuAll=function(){ /*** 旧页面内容提取 ****/
		var contentHtml = "";
		var that = this;
		$(".inner").each(function(){
			contentHtml += that.copybaiduWenkuOne($(this), false);
		});
		if(!!contentHtml){
			this.showBaiduCopyContentBox(contentHtml);
		}else{
			this.showDialog("提取文档内容失败了");
		}
	};
	baiduwenkuHelper.copybaiduWenkuOne=function($inner, isappend){
		var $that = this;
		var str = "";  //提取文字
		
		$inner.find('.reader-word-layer').each(function(){
			str += $(this).text().replace(/\u2002/g, ' ');
		});
		$inner.find('.p-txt').each(function(){
			str += $(this).text().replace(/\u2002/g, ' ');
		});
		str = str.replace(/。\s/g, '。\r\n');
		
		//提取css中的图片
		var picHtml = "";
		var picUrlReg = /\(((\'|\")?https.*?)\)/i;
		var cssUrl = "";
		var picNum = 0;
		var picUrlLengthMin = 65;
		var picTemplate = "<div style='margin:10px 0px;text-align:center;'><img src='@' width='90%'><div>____图(#)____</div></div>";
		$inner.find('.reader-pic-item').each(function(){
			cssUrl= $(this).css("background-image");
			if(!!cssUrl && (cssUrl.indexOf("https")!=-1 || cssUrl.indexOf("HTTPS")!=-1)){
				var array = cssUrl.match(picUrlReg);
				if(array.length>1){
					cssUrl = array[1].replace(/\"/g, "");
					if(!!cssUrl && cssUrl.length>picUrlLengthMin){
						picNum ++;
						var onePic = picTemplate;
						onePic = onePic.replace(/#/g,picNum);
						onePic = onePic.replace(/@/g,cssUrl);
						picHtml += onePic;
					}
				}
			}
			
		});
		
		var srcUrl = "";
		$inner.find('img').each(function(){
			srcUrl = $(this).attr("src");
			if(!!srcUrl && srcUrl.length>picUrlLengthMin && srcUrl.indexOf("https://wkretype")!=-1){
				picNum ++;
				var onePic = picTemplate;
				onePic = onePic.replace(/#/g,picNum);
				onePic = onePic.replace(/@/g,srcUrl);
				picHtml += onePic;
			}
		});
		
		//追加内容
		var contentHtml = str+picHtml;
		if(!!contentHtml && contentHtml.length>0){
			if(isappend){
				$that.showBaiduCopyContentBox(contentHtml);
			}
			return contentHtml;
		}else{
			if(isappend){
				$that.showDialog("提取文档内容失败了");
			}
			return "";
		}
	};
	baiduwenkuHelper.start=function(){
		if(this.isRun()){			
			this.generateHtml();
			this.removeAD();
		}
	};
	baiduwenkuHelper.start();
})();


/**
 * 作者备注:
 * 王超先生的知乎视频下载脚本代码非常精炼,我认为此功能不需要再二次编写了
 * 此部分代码已获得原作者授权同意,并符合MIT协议,请知悉!
 * 
 * 下载知乎视频,作者:王超, 脚本链接:https://greasyfork.org/zh-CN/scripts/39206
 * 版本:1.30
 * 版权归原作者所有
 */
(async () => {
  if (window.location.host == 'www.zhihu.com') return;
 
  console.log('知乎视频下载:');
 
  const playlistBaseUrl = 'https://lens.zhihu.com/api/v4/videos/';
  // const videoBaseUrl = 'https://video.zhihu.com/video/';
  const videoId = window.location.pathname.split('/').pop(); // 视频id
  const menuStyle = 'transform:none !important; left:auto !important; right:-0.5em !important;';
  const playerId = 'player';
  const coverSelector = '#' + playerId + ' > div:first-child > div:first-child > div:nth-of-type(2)';
  const controlBarSelector = '#' + playerId + ' > div:first-child > div:first-child > div:last-child > div:last-child > div:first-child';
  const svgDownload = '<path d="M9.5,4 H14.5 V10 H17.8 L12,15.8 L6.2,10 H9.5 Z M6.2,18 H17.8 V20 H6.2 Z"></path>';
  const player = document.getElementById(playerId);
  // const resolutions = {'普清': 'ld', '标清': 'sd', '高清': 'hd', '超清': 'fhd'};
  const resolutions = [
    {ename: 'ld', cname: '普清'},
    {ename: 'sd', cname: '标清'},
    {ename: 'hd', cname: '高清'},
    {ename: 'fhd', cname: '超清'}
  ];
  let videos = []; // 存储各分辨率的视频信息
 
  function fetchRetry (url, options = {}, times = 1, delay = 1000, checkStatus = true) {
    return new Promise((resolve, reject) => {
      // fetch 成功处理函数
      function success (res) {
        if (checkStatus && !res.ok) {
          failure(res);
        }
        else {
          resolve(res);
        }
      }
 
      // 单次失败处理函数
      function failure (error) {
        if (--times) {
          setTimeout(fetchUrl, delay);
        }
        else {
          reject(error);
        }
      }
 
      // 总体失败处理函数
      function finalHandler (error) {
        throw error;
      }
 
      function fetchUrl () {
        return fetch(url, options)
          .then(success)
          .catch(failure)
          .catch(finalHandler);
      }
 
      fetchUrl();
    });
  }
 
  // 下载指定url的资源
  async function downloadUrl (url, name = (new Date()).valueOf() + '.mp4') {
    // Greasemonkey 需要把 url 转为 blobUrl
    if (GM_info.scriptHandler === 'Greasemonkey') {
      const res = await fetchRetry(url);
      const blob = await res.blob();
      url = URL.createObjectURL(blob);
    }
 
    // Chrome 可以使用 Tampermonkey 的 GM_download 函数绕过 CSP(Content Security Policy) 的限制
    if (window.GM_download) {
      GM_download({url, name});
    }
    else {
      // firefox 需要禁用 CSP, about:config -> security.csp.enable => false
      let a = document.createElement('a');
      a.href = url;
      a.download = name;
      a.style.display = 'none';
      // a.target = '_blank';
      document.body.appendChild(a);
      a.click();
      document.body.removeChild(a);
 
      setTimeout(() => URL.revokeObjectURL(url), 100);
    }
  }
 
  // 格式化文件大小
  function humanSize (size) {
    let n = Math.log(size) / Math.log(1024) | 0;
    return (size / Math.pow(1024, n)).toFixed(0) + ' ' + (n ? 'KMGTPEZY'[--n] + 'B' : 'Bytes');
  }
 
  if (!player) return;
 
  // 获取视频信息
  const res = await fetchRetry(playlistBaseUrl + videoId, {
    headers: {
      'referer': 'refererBaseUrl + videoId',
      'authorization': 'oauth c3cef7c66a1843f8b3a9e6a1e3160e20' // in zplayer.min.js of zhihu
    }
  }, 3);
  const videoInfo = await res.json();
 
  // 获取不同分辨率视频的信息
  for (const [key, video] of Object.entries(videoInfo.playlist)) {
    video.name = key.toLowerCase();
    video.cname = resolutions.find(v => v.ename === video.name)?.cname
    if (!videos.find(v => v.size === video.size)) {
      videos.push(video);
    }
  }
 
  // 按格式大小排序
  videos = videos.sort(function (v1, v2) {
    const v1Index = resolutions.findIndex(v => v.ename === v1.name);
    const v2Index = resolutions.findIndex(v => v.ename === v2.name);
 
    return v1Index === v2Index ? 0 : (v1Index > v2Index ? 1 : -1);
    // return v1.size === v2.size ? 0 : (v1.size > v2.size ? 1 : -1);
  }).reverse();
 
  document.addEventListener('DOMNodeInserted', (evt) => {
    const domControlBar = evt.relatedNode.querySelector(':scope > div:last-child > div:first-child > div:nth-of-type(2)');
    if (!domControlBar || domControlBar.querySelector('.download')) return;
 
    const domButtonsBar = domControlBar.querySelector(':scope > div:last-child');
    const domFullScreenBtn = domButtonsBar.querySelector(':scope > div:nth-last-of-type(2)');
    const domResolutionBtn = Array.from(domButtonsBar.querySelectorAll(':scope > div')).filter(el => el.innerText.substr(1, 1) === '清')[0];
    let domDownloadBtn, defaultResolution, buttons;
    if (!domFullScreenBtn || !domFullScreenBtn.querySelector('button')) return;
 
    // 克隆分辨率菜单或全屏按钮为下载按钮
    domDownloadBtn = (domResolutionBtn && (domResolutionBtn.className === domFullScreenBtn.className))
      ? domResolutionBtn.cloneNode(true)
      : domFullScreenBtn.cloneNode(true);
 
    defaultResolution = domDownloadBtn.querySelector('button').innerText;
 
    // 生成下载按钮图标
    domDownloadBtn.querySelector('button:first-child').outerHTML = domFullScreenBtn.cloneNode(true).querySelector('button').outerHTML;
    domDownloadBtn.querySelector('svg').innerHTML = svgDownload;
    domDownloadBtn.className = domDownloadBtn.className + ' download';
 
    buttons = domDownloadBtn.querySelectorAll('button');
 
    // button 元素添加对应的下载地址属性
    buttons.forEach(dom => {
      const video = videos.find(v => v.cname === dom.innerText) || videos[videos.length - 1];
 
      dom.dataset.video = video.play_url;
      if (dom.innerText) {
        (dom.innerText = `${dom.innerText} (${humanSize(video.size)})`);
      }
      else if (buttons.length == 1) {
        dom.nextSibling.querySelector('div').innerText = humanSize(video.size);
      }
    });
 
    // 鼠标事件 - 显示菜单
    domDownloadBtn.addEventListener('pointerenter', () => {
      const domMenu = domDownloadBtn.querySelector('div:nth-of-type(1)');
      if (domMenu) {
        domMenu.style.cssText = menuStyle + 'opacity:1 !important; visibility:visible !important';
      }
    });
 
    // 鼠标事件 - 隐藏菜单
    domDownloadBtn.addEventListener('pointerleave', () => {
      const domMenu = domDownloadBtn.querySelector('div:nth-of-type(1)');
      if (domMenu) {
        domMenu.style.cssText = menuStyle;
      }
    });
 
    // 鼠标事件 - 选择菜单项
    domDownloadBtn.addEventListener('pointerup', event => {
      let e = event.srcElement || event.target;
 
      while (e.tagName !== 'BUTTON') {
        e = e.parentNode;
      }
 
      downloadUrl(e.dataset.video);
    });
 
    // 显示下载按钮
    domButtonsBar.appendChild(domDownloadBtn);
  });
})();