Greasy Fork

全网VIP视频解析, 去广告, 超清播放, 支持优酷、腾讯、爱奇艺、芒果、PPTV、咪咕视频等全网VIP视频 2021/09/12 更新

VIP视频解析集合;支持【爱奇艺,优酷视频,乐视TV,腾讯视频,土豆视频,搜狐视频,PPTV,M1905,暴风影音,哔哩哔哩,咪咕视频】等全网VIP视频

目前为 2021-09-12 提交的版本。查看 最新版本

// ==UserScript==
// @name         全网VIP视频解析, 去广告, 超清播放, 支持优酷、腾讯、爱奇艺、芒果、PPTV、咪咕视频等全网VIP视频 2021/09/12 更新
// @namespace    http://tv.oopw.top/
// @version      1.7.6
// @description  VIP视频解析集合;支持【爱奇艺,优酷视频,乐视TV,腾讯视频,土豆视频,搜狐视频,PPTV,M1905,暴风影音,哔哩哔哩,咪咕视频】等全网VIP视频
// @author       liheng
// @icon         http://tv.13tv.top/favicon.ico
// @match         *://m.youku.com/v*
// @match         *://m.youku.com/a*
// @match         *://v.youku.com/v_*
// @match         *://*.iqiyi.com/v_*
// @match         *://*.iqiyi.com/w_*
// @match         *://*.iqiyi.com/a_*
// @match         *://*.iqiyi.com/adv*
// @match         *://*.le.com/ptv/vplay/*
// @match         *://*.le.com/vplay*
// @match         *://v.qq.com/x/cover/*
// @match         *://v.qq.com/cover*
// @match         *://v.qq.com/x/page/*
// @match         *://v.qq.com/play*
// @match         *://m.v.qq.com/play*
// @match         *://m.v.qq.com/x/m/play*
// @match         *://m.v.qq.com/x/play*
// @match         *://*.tudou.com/listplay/*
// @match         *://*.tudou.com/albumplay/*
// @match         *://*.tudou.com/programs/view/*
// @match         *://*.tudou.com/v_show/*
// @match         *://*.tudou.com/v/*
// @match         *://*.mgtv.com/b/*
// @match         *://*.mgtv.com/s/*
// @match         *://film.sohu.com/album/*
// @match         *://tv.sohu.com/v/*
// @match         *://m.tv.sohu.com/v*
// @match         *://m.tv.sohu.com/album/*
// @match         *://*.pptv.com/show/*
// @match         *://*.wasu.cn/Play/show/*
// @match         *://*.wasu.cn/wap/Play/show/*
// @match         *://*.wasu.cn/wap/play/show/*
// @match         *://vip.1905.com/play/*
// @match         *://*.bilibili.com/video/*
// @match         *://*.bilibili.com/anime/*
// @match         *://*.bilibili.com/bangumi/play/*
// @match         *://*.baofeng.com/play/*
// @match         *://*.miguvideo.com/wap/resource/pc/detail/*
// @match         *://*.miguvideo.com/mgs/website/prd/detail*
// @match         *://*.miguvideo.com/mgs/msite/prd/detail*
// @match         *://*.fun.tv/vplay/*
// @match         *://*.fun.tv/mplay/*
// @namespace       Heng
// @license         GPL-3.0-only
// @grant           GM_xmlhttpRequest
// ==/UserScript==
(function(){
	var mCurSite = null;
	var isDebug = false;
	var debugX = isDebug?console.log.bind(console):function(){};
	var Config = {
		iqiyi:{
			// 爱奇艺视频 https://www.iqiyi.com/v_19rrfq5ajk.html
			// insertTo = 插入在xx节点
			// adStyle 自定义完整样式-用于移除广告
			// sStyle 按钮样式定义
			// title 标题文字内容获取
			insertTo:".header-txt, .qy-player-detail .qy-player-title, .videoInfoFold-title .c-title, .video-title .c-title, .qy-player-vippay-popup .btn-wrap",
			adStyle:".pw-video>div[data-cupid]>div[style*='position']{display:none !important}",
			sStyle:"width: unset;",
			title:".video-title .c-title, .player-title, .videoInfoFold-title .c-title",
		},
		youku:{
			// 优酷视频 https://v.youku.com/v_show/id_XMzc2ODA1OTQwNA==.html?spm=a2hww.11359951.m_26665_c_32069.5~5!3~5!2~5~5~A
			// 可用     https://v.youku.com/v_show/id_XMzc4MjEzMjg0NA==.html
			insertTo:".title-wrap .desc, .tvinfo>h2, .vip_info .vip_limit_title, .normal-title-wrap, .module-name",
			adStyle:"",
			sStyle:"width: unset;",
			title:".title-width .subtitle, .module-name h1",
		},
		le:{
			// 乐视TV http://www.le.com/ptv/vplay/28636951.html
			insertTo:".intro_cnt h2, .j_jujiName, .briefIntro_tit, #le_playbox .playbox_vip_tip>h3",
			adStyle:".layout_play iframe{display:none;}",
			sStyle:"vertical-align: bottom;width: unset;",
			title:".briefIntro_box .briefIntro_tit>a",
		},
		v_qq:{
			// 腾讯视频 https://v.qq.com/x/cover/babks6vmrn25n9c.html
			// https://v.qq.com/x/page/q0390tz0d2o.html
			// iourl 视频列表地址
			insertTo:" .scroll_top .player_title, .mod_intro .video_title, .content .title, .mod_video_info .video_function",
			adStyle:"",
			sStyle:"width:unset;",
			title:".video_title",
			iourl:".scroll_wrap .mod_episode .current a, .panel_body .mod_figure .current a",
		},
		tudou:{ //---地址match也有待检查
			// 土豆视频 http://video.tudou.com/v/XMzYxMzMyMDIzMg==.html
			// TODO 限制参数请求必须是:http://yun.baiyug.cn/vip/index.php?url=http://video.tudou.com/v/XMzYxMzMyMDIzMg== 不能带别的参数
			insertTo:".normal-title-wrap .thesis-wrap, .title-wrap .title-width, .brief-title .module-name",
			adStyle:"",
			sStyle:"width:unset;color: red !important;font-size:unset;",
			title:".normal-title-wrap .title-link, .brief-title h1",
		},
		mgtv:{
			// 芒果TV https://www.mgtv.com/b/318945/4470636.html
			insertTo:" .control-left .title, .header-title-box .name, .list .n-comment, .m-aside-header .name, .movie .info",
			adStyle:"",
			sStyle:"width: unset;",
			title:".control-left .title, .hd .vt-txt",
		},
		sohu:{
			// 搜狐视频 https://tv.sohu.com/v/MjAxODA4MDIvbjYwMDU3NzU0NS5zaHRtbA==.html
			// https://film.sohu.com/album/9337002.html?channeled=1200030002 ---- 新增支持
			insertTo:".videoBox .vBox-desktop, .playerBox .juji_tips>h4, #player_vipTips .vipTipsIn>.p1, .detailInfo_box>p:nth-child(1), .play-end-pop .top-buy-box, .movie-t, .videoInfo .crumb, .twinfo_iconwrap .info_commentnum",
			adStyle:"#crumbsBar .ad{display:none}.area>.left>.adv{display:none}",
			sStyle:"width: unset;",
			title:".showname, .movie-t h3, .tw-info .t-info, .vinfobox h2",
		},
		bilibili:{
			// 哔哩哔哩 可能还有其他的视频地址
			// https://www.bilibili.com/bangumi/play/ep232412
			insertTo:" .media-rating .score, .tool-bar, .media-option-tab",
			adStyle:"",
			sStyle:"width: unset;margin-top: -0.5rem;margin-left: 2rem;",
			title:"#media_module .media-title",
		},
		pptv:{
			// PPTV http://v.pptv.com/show/d2A9uiaKIibDaZF38.html?spm=vip_index_web.vip_d58855eb506e6c89f7eeb434e0955c41.0.0.0
			insertTo:".player-sidebar .tithide li:nth-child(1)>a, #mainContent .cf ul.fl, .video_func .video_function_right",
			adStyle:"",
			sStyle:"width: unset;",
			title:".mobilelook-pop-wrap .tv-name, .video_title span",
		},
		yinyuetai:{
			// 音悦台 http://v.yinyuetai.com/video/3271056
			// http://v.yinyuetai.com/playlist/265520        ---- 不支持这个地址
			insertTo:".videoBox .video_info .videoName",
			adStyle:"",
			sStyle:"",
			title:".videoName:first", // split("    ")
		},
		wasu:{
			// 华数TV https://www.wasu.cn/Play/show/id/9567710
			insertTo:".play_site .play_name, .play_video_b .l, .play_site h3, .player_menu_con",
			adStyle:".container div[class*='play_ads']{display:none}#MZAD_POP_PLACEHOLDER,.ad_list{display:none !important}",
			sStyle:"width: unset;",
			title:".play_site .play_name b, .play_site h3, .play_info h2",
		},
		1905:{
			// 1905 https://vip.1905.com/play/1517219.shtml
			insertTo:".sc-pay-wrapper>.sc-pay-button-wrapper, .page_play>.player-nav, #pSidebar .movie-title, #pSidebar .pay-mod-notlogin .vip-logloglog, .dramaInfos .fl h3, .dramaTitle, .infoInner",
			adStyle:"",
			sStyle:"width: unset;",
			title:".player-nav .nav-title, .fl h3 span, .infoInner .title",
		},
        baofeng:{
			// 暴风影音 http://www.baofeng.com/play/84/play-848584.html
			insertTo:".play-top-box .play-title-box .play-tit h1, .vip-buy .vip-bigtit",
			adStyle:"",
			sStyle:"float:right",
			title:".play-top-box .play-title-box .play-tit h1 a",
		},
        miguvideo:{
			// 咪咕视频 http://www.miguvideo.com/mgs/website/prd/detail.html?cid=646800448
			insertTo:".playerSideBar .episodeTop, .playerFooter .video_base, .left-box .title",
			adStyle:"",
			sStyle:"width: unset;",
			title:".playerSideBar .episodeTop span, .program-desc-01 .title",
		},
		fun:{
			// 风行网 http://www.fun.tv/vplay/g-103770/
			insertTo:".playBoxWrap .pl-tit, .leftBtn .headline, .f-cb .title",
			adStyle:"",
			sStyle:"width: unset; height: 20px; line-height: 20px;",
			title:".leftBtn .cru-tit, .f-cb .j-video-name",
		},
	};
	function initSite(){
		for(var key in Config){
			if(location.host.replace(/\./ig, "_").indexOf(key) >= 0){
				debugX("当前站点:"+key);
				mCurSite = Config[key];
				mCurSite.name = key;
				break;
			}
		}
	}
	function safeRemove(node){
		try{
			faNodes[i].querySelector(".acInG").remove();
		}catch (e) {}
	}
	function TU_addStyle(css, className, addToTarget, isReload){ // 添加CSS代码,不考虑文本载入时间,带有className
		var tout = setInterval(function(){
			addToTarget = addToTarget || "body";
			isReload = isReload || false;
			if(document.querySelector(addToTarget) != null){
				clearInterval(tout);
				if(isReload == true){
					safeRemove(document.querySelector("."+className));
				}else if(isReload == false && document.querySelector("."+className) != null){
					// 节点存在 && 不准备覆盖
					return;
				}
				var cssNode = document.createElement("style");
				if(className != null) cssNode.className = className;
				cssNode.id = "AC-"+className;
				cssNode.setAttribute("type", "text/css")
				cssNode.innerHTML = css;
				try{
					document.querySelector(addToTarget).appendChild(cssNode);
				}catch (e){console.log(e.message);}
			}
		}, 50);
	}

	/**
	 * 执行站点VIP解析插入操作
	 */
	function doInsert(){
		if(mCurSite == null) return;
		TU_addStyle(mCurSite.adStyle, "tu-ad-style-remove"); // 添加部分拦截广告的规则
		var insertNode = document.createElement("span");
		insertNode.style = ";background-color:#fff700;width: 6rem;cursor: pointer; text-decoration: none; color: red; padding: 0px 5px; border: 1px solid red; font-size: 17px; display: inline-flex; height: 24px; line-height: 24px; margin: 0px 5px;" + mCurSite.sStyle;
		insertNode.innerHTML = "VIP解析";
		insertNode.target = "_balnk";
		insertNode.className = "acInG";
		var title = "";
		try{
			title = document.querySelector(mCurSite.title).innerText.split("   ")[0].trim();
			title = encodeURIComponent(title);
		}catch (e) {
			debugX(document.location.href);
			debugX("找不到节点:" + mCurSite.name);
			debugX(e);
		}
        var videoURL = "";
        var viURL = window.location.href;
        if(viURL.indexOf("v.qq.com") != -1){
            if(viURL.indexOf("m.v.qq.com") != -1){videoURL = viURL;
                }else{
                    videoURL = document.querySelector(mCurSite.iourl).href;
                };
        }else{videoURL = viURL;
        };
		title = title.replace(/VIP解析$/, "");
		var url = "http://www.13tv.top/label/v.html?url=" + videoURL + "&title=" + title;
		insertNode.dataset.url = url;
		insertNode.setAttribute("onclick", "window.open(this.dataset.url);");
		var faNodes = document.querySelectorAll(mCurSite.insertTo);

		for(var i = 0; i < faNodes.length; i++){
			if(faNodes[i].querySelector(".acInG:not([title])") == null){
				debugX("新增按钮");
				safeRemove(faNodes[i].querySelector(".acInG"));
				faNodes[i].appendChild(insertNode.cloneNode(true));
				faNodes[i].setAttribute("acIns", "");
				if(title != "") {
					faNodes[i].setAttribute("title", title);
				}
			}else{
				faNodes[i].querySelector(".acInG:not([title])").dataset.url = url;
			}
		}
	}
	debugX("数据初始化");
	initSite();
	(function(){
		TU_addStyle(".acInG:hover{color: rgba(255,200,0,30) !important;border: 1px dashed rgba(255,200,100,10) !important;text-shadow: 0 0px rgba(242,33,49,30),0 0px 0px rgba(242,33,49,30),0 1px 1px rgba(242,33,49,30),1px 0 1px rgba(242,33,49,30),-1px 0 1px rgba(242,33,49,30),0 0 1px rgba(242,33,49,30) !important;}");
		document.addEventListener('DOMNodeInserted', function (e) {
			debugX("html文档载入完成");
			if(e.target != null && e.target.className != null && e.target.id.indexOf("AC-") == 0){ return; } //屏蔽掉因为增加css导致的触发insert动作
			doInsert();
		}, false);
	})();
})();