From e2e73c4a6f330b5e79da0e570b219b7af0afd966 Mon Sep 17 00:00:00 2001 From: hjdhnx Date: Fri, 7 Oct 2022 20:07:56 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8F=9C=E7=8B=97=E6=92=AD=E6=94=BE=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "js/\350\217\234\347\213\227.js" | 3 +- libs/drpy.js | 49 +++++++++++-------- ...34\347\213\227\345\205\215\345\227\205.js" | 6 ++- 3 files changed, 34 insertions(+), 24 deletions(-) diff --git "a/js/\350\217\234\347\213\227.js" "b/js/\350\217\234\347\213\227.js" index e268f12..8710536 100644 --- "a/js/\350\217\234\347\213\227.js" +++ "b/js/\350\217\234\347\213\227.js" @@ -20,7 +20,8 @@ var rule = { limit:20, play_parse:true, // 手动调用解析请求json的url,此lazy不方便 - lazy:'js:print(input);fetch_params.headers["user-agent"]=MOBILE_UA;let html=request(input);let rurl=html.match(/window\\.open\\(\'(.*?)\',/)[1];rurl=urlDeal(rurl);input={parse:1,url:rurl};', + lazy:'', + lazy:'js:print(input);fetch_params.headers["User-Agent"]=MOBILE_UA;print(fetch_params);let html=request(input);let rurl=html.match(/window\\.open\\(\'(.*?)\',/)[1];rurl=urlDeal(rurl);input={parse:1,jx:1,url:rurl};', // 推荐:'.list_item;img&&alt;img&&src;a&&Text;a&&data-float', 一级:'js:let d=[];let html=request(input);html=JSON.parse(html);let list=html.listData.results;list.forEach(function(it){let desc1=it.ipad_play_for_list.finish_episode?it.ipad_play_for_list.episode===it.ipad_play_for_list.finish_episode?"全集"+it.ipad_play_for_list.finish_episode:"连载"+it.ipad_play_for_list.episode+"/"+it.ipad_play_for_list.finish_episode:"";let desc2=it.score?"评分:"+it.score:"";let desc3=it.date?"更至:"+it.date:"";d.push({title:it.name,img:it.v_picurl,url:"https://v.sogou.com"+it.url.replace("teleplay","series").replace("cartoon","series"),desc:desc1||desc2||desc3})});setResult(d);', 二级:'', diff --git a/libs/drpy.js b/libs/drpy.js index ed132e0..c9a7254 100644 --- a/libs/drpy.js +++ b/libs/drpy.js @@ -218,10 +218,8 @@ function setResult(d){ return [] } VODS = []; - print(221); - console.log(JSON.stringify(d)); + // print(d); d.forEach(function (it){ - print(it); let obj = { vod_id:it.url||'', vod_name: it.title||'', @@ -229,7 +227,6 @@ function setResult(d){ vod_content: it.content||'', vod_pic: it.pic_url||it.img||'', }; - print(obj); let keys = Object.keys(it); if(keys.includes('tname')){ obj.type_name = it.tname||''; @@ -249,12 +246,8 @@ function setResult(d){ if(keys.includes('area')){ obj.vod_area = it.area||''; } - print(251); VODS.push(obj); - print(VODS); }); - print(256); - print(VODS); return VODS } function setResult2(res){ @@ -326,6 +319,10 @@ function base64Encode(text){ return text } +function base64Decode(text){ + return text +} + globalThis.VODS = [];// 一级或者搜索需要的数据列表 globalThis.VOD = {};// 二级的单个数据 globalThis.encodeUrl = urlencode; @@ -719,16 +716,19 @@ function require(url){ */ function request(url,obj){ if(typeof(obj)==='undefined'||!obj||obj==={}){ - let headers = { - 'User-Agent':MOBILE_UA, - 'Referer':getHome(url), - }; - if(rule.headers){ - Object.assign(headers,rule.headers); + if(!fetch_params||!fetch_params.headers){ + let headers = { + 'User-Agent':MOBILE_UA, + }; + if(rule.headers){ + Object.assign(headers,rule.headers); + } + fetch_params.headers = headers; } - obj = { - headers:headers + if(!fetch_params.headers.Referer){ + fetch_params.headers.Referer = getHome(url) } + obj = fetch_params; }else{ let headers = obj.headers||{}; let keys = Object.keys(headers).map(it=>it.toLowerCase()); @@ -1371,7 +1371,7 @@ function detailParse(detailObj){ } vod.vod_play_url = vod_tab_list.join(vod_play_url); } - console.log(JSON.stringify(vod)); + // print(vod); return JSON.stringify({ list: [vod] }) @@ -1384,18 +1384,25 @@ function detailParse(detailObj){ */ function playParse(playObj){ MY_URL = playObj.url; - var input = MY_URL; + if(!/http/.test(MY_URL)){ + try { + MY_URL = base64Decode(MY_URL); + }catch (e) {} + } + MY_URL = decodeURIComponent(MY_URL); + var input = MY_URL;//注入给免嗅js let common_play = { parse:1, - url:MY_URL + url:input }; let lazy_play; if(!rule.play_parse||!rule.lazy){ lazy_play = common_play; }else if(rule.play_parse&&rule.lazy&&typeof(rule.lazy)==='string'){ try { - print('开始执行js免嗅=>'+rule.lazy); - eval(rule.lazy.replace('js:').trim()); + let lazy_code = rule.lazy.replace('js:','').trim(); + print('开始执行js免嗅=>'+lazy_code); + eval(lazy_code); lazy_play = typeof(input) === 'object'?input:{ parse:1, jx:1, diff --git "a/py/\346\220\234\347\213\227\345\205\215\345\227\205.js" "b/py/\346\220\234\347\213\227\345\205\215\345\227\205.js" index 7a85a73..265a625 100644 --- "a/py/\346\220\234\347\213\227\345\205\215\345\227\205.js" +++ "b/py/\346\220\234\347\213\227\345\205\215\345\227\205.js" @@ -2,7 +2,9 @@ js: // fetch_params.withHeaders = 1; // let data=fetch(input,fetch_params); // let html = data.body; -fetch_params.headers['user-agent'] = MOBILE_UA; +print(input); +fetch_params.headers['User-Agent'] = MOBILE_UA; +print(fetch_params); let html=request(input); // let rurl = html.match(/window\.open\('(.*?)',/)[1].split('?')[0]; let rurl = html.match(/window\.open\('(.*?)',/)[1]; @@ -10,5 +12,5 @@ let rurl = html.match(/window\.open\('(.*?)',/)[1]; rurl = urlDeal(rurl); // print(rurl); // input = rurl; -input = {parse:1,url:rurl}; +input = {parse:1,jx:1,url:rurl}; // print(html); -- GitLab