// ==UserScript== // @name:en-US CCTV-HLS // @name CCTV视频解析 // @description:en-US parse cctv video to hls url. // @description 将CCTV视频解析成HLS地址. // @namespace https://greasyfork.org/users/135090 // @version 1.0 // @author ZWB // @license CC // @grant none // @run-at document-end // @match https://v.cctv.com/2*/V*.shtml* // @match https://v.cctv.cn/2*/V*.shtml* // @match https://tv.cctv.cn/2*/V*.shtml* // @match https://tv.cctv.com/2*/V*.shtml* // @icon https://tv.cctv.cn/favicon.ico // @downloadURL none // ==/UserScript== (function(){ setTimeout(function(){ if (this.videoid == "myPlayer") { var mpu="https://vdn.apps.cntv.cn/api/getHttpVideoInfo.do?pid="+guid; var cctvb=document.createElement("a"); cctvb.style.display="grid"; cctvb.textContent="#JSON#"; cctvb.style.fontSize="2vw"; cctvb.style.color="#48EFEF"; document.querySelector("#via_title").appendChild(cctvb); cctvb.href=mpu; document.querySelector("#myPlayer").innerHTML=null; $.getJSON(mpu,function(res){ var cctva=document.createElement("a"); cctva.style.display="grid"; cctva.textContent="#MP4#"; cctva.style.fontSize="2vw"; cctva.style.color="#28EFEF"; document.querySelector("#via_title").appendChild(cctva); cctva.href=res.video.chapters4[0].url; }); } else { setTimeout(function(){ document.querySelector(".video_left").innerHTML=null; },500); var mu="https://vdn.apps.cntv.cn/api/getHttpVideoInfo.do?pid="+guid; var cctvc=document.createElement("a"); cctvc.style.display="grid"; cctvc.style.float="left"; cctvc.textContent="#JSON#"; cctvc.style.fontSize="2vw"; cctvc.style.color="#48EFEF"; document.querySelector("#video").parentElement.appendChild(cctvc); cctvc.href=mu; $.getJSON(mu,function(res){ var cctva=document.createElement("a"); cctva.style.display="grid"; cctva.style.float="right"; cctva.textContent="#HLS#"; cctva.style.fontSize="2vw"; cctva.style.color="#28EFEF"; document.querySelector("#video").parentElement.appendChild(cctva); var code1200=res.hls_url.replaceAll("main","1200"); cctva.href=code1200; /* cctva.onclick=function(){ window.open(res.hls_url); }; */ var cctvv=document.createElement("a"); cctvv.style.display="grid"; cctvv.style.float="right"; cctvv.textContent=res.hls_url; cctvv.style.fontSize="2vw"; cctvv.style.color="#28EFEF"; document.querySelector("#video").parentElement.appendChild(cctvv); cctvv.onclick=function(){ window.open(res.hls_url); }; }); } },500); })();