全网视频解析
window.cookie = { set:function(key,val,seconds){//设置cookie方法 let date=new Date(); //获取当前时间 date.setTime(date.getTime()+seconds*1000); //格式化为cookie识别的时间 val=escape(val) document.cookie=key + "=" + val +";expires="+date.toGMTString()+";domain="+".cnblogs.com;path=/"; //设置cookie }, get:function(key){//获取cookie方法 /*获取cookie参数*/ let getCookie = document.cookie.replace(/[ ]/g,""); //获取cookie,并且将获得的cookie格式化,去掉空格字符 let arrCookie = getCookie.split(";") //将获得的cookie以"分号"为标识 将cookie保存到arrCookie的数组中 let tips; //声明变量tips for(let i=0;i<arrCookie.length;i++){ //使用for循环查找cookie中的tips变量 let arr=arrCookie[i].split("="); //将单条cookie用"等号"为标识,将单条cookie保存为arr数组 if(key==arr[0]){ //匹配变量名称,其中arr[0]是指的cookie名称,如果该条变量为tips则执行判断语句中的赋值操作 tips=arr[1]; //将cookie的值赋给变量tips break; //终止for循环遍历 } } return unescape(tips); }, delete:function(key){ //删除cookie方法 let date = new Date(); //获取当前时间 date.setTime(date.getTime()-10000); //将date设置为过去的时间 document.cookie = key + "=v; expires =" +date.toGMTString();//设置cookie } } $('#holder').html(""); if(window.cb_entryId==undefined) window.cb_entryId=$(".cnblogs-post-body")[0].id.split("body_")[1]; if(cookie.get(cb_entryId)!="undefined"){ let obj=JSON.parse(cookie.get(cb_entryId)) $('#url').val(obj.url); }else $('#url').val("https://www.mgtv.com/b/100931/3049751.html"); let opt="0"; $("#select").change(function(){ opt=$("#select").val(); console.log(opt) let url=$("#url").val() play(url,opt) }); $("#play").click(function(){ let url=$("#url").val() play(url,opt) }) function play(url,index){ $('#holder').html(""); let iframe = document.createElement('iframe'); let jx=""; switch(index){ case "0": jx="https://api.47ks.com/webcloud/?v="; break; case "1": jx="https://www.bihumoon.com/ckmov/index.php?url="; break; case "2": jx="https://jx.618g.com/md/?url="; break; case "3": jx="https://www.loveyinzi.cc/qipacao/index.php?url="; break; default: jx="https://api.47ks.com/webcloud/?v="; } iframe.src=jx+url; iframe.name="videoFrame"; console.log(jx+url); iframe.width="100%"; iframe.height="550px"; iframe.allowFullscreen=true; let holder=$('#cnblogs_post_body #holder,.cnblogs-post-body #holder')[0]; holder.appendChild(iframe); let obj={} obj.url=url let json=JSON.stringify(obj) cookie.set(cb_entryId,json,365*24*60*60) }