From c371401f0a9cf300029168f17fcd6e0fa649eafe Mon Sep 17 00:00:00 2001 From: hjdhnx Date: Mon, 12 Dec 2022 11:27:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E4=B8=AA=E7=89=88=E6=9C=AC=E5=8F=B7,?= =?UTF-8?q?=E6=94=B9=E4=B8=AA=E5=93=94=E5=93=A9=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base/rules.db | Bin 155648 -> 155648 bytes controllers/parse.py | 4 + "jiexi/\345\223\224\345\223\251.js" | 91 ++++++++++++++++++ "jiexi/\346\227\240\345\220\215.js" | 1 + ...\345\275\261\351\231\242[\351\243\236].js" | 15 +++ js/version.txt | 2 +- ...02\351\225\277\350\265\204\346\272\220.js" | 14 +-- ...67\345\256\242\345\275\261\351\231\242.js" | 5 +- "js/\351\245\255\345\233\242.js" | 16 ++- "js/\351\272\246\350\261\206com.js" | 23 ++--- readme.md | 3 + 11 files changed, 141 insertions(+), 33 deletions(-) create mode 100644 "jiexi/\345\223\224\345\223\251.js" create mode 100644 "js/AB\345\275\261\351\231\242[\351\243\236].js" diff --git a/base/rules.db b/base/rules.db index fb49499917ed6bc5ae9af2f2cb91b58268ab3c07..f2d5792ac1b62503ce2f47fa57b43d86b18256d1 100644 GIT binary patch delta 248 zcmXAiy-LGS7(fjo(%G$cD1mN*_q+eMAwy_7h)|HIYt6m)3&aX3Mg(zau$ekp`VQ`$ zT>Borj6ui4;c%KmuQ~KS&x2??m;}-O;cFFCyVFJo)qZ<Qo@xM9TeJ9IiiV!X!w^tx|i4#mI?(_bK+P| z1TvwtE-oPo fKol@jXo-*$jwZKg1p$dnDd%9lX}>pZ@cQ!$jmk-# delta 185 zcmZoTz}awsbAmLZ+`2GOR!uNlY1~VAtSa7sn7sTTA0K!z2sKWK|<)Lo*9gQv+i|BNHIU z+{_@=K-I`G+0a@6Y-m<;iLGg>L84)*nW?3@WtvF}5L=|B@K`1rnpzl}86}yT8&7`F P9N*mCvc0>7vGg_oYi&Ag diff --git a/controllers/parse.py b/controllers/parse.py index 5ad175a..4c6af00 100644 --- a/controllers/parse.py +++ b/controllers/parse.py @@ -11,6 +11,7 @@ from utils.log import logger from utils.encode import OcrApi,base64ToImage from controllers.service import storage_service from utils.pyctx import py_ctx,getPreJs,runJScode,JsObjectWrapper,PyJsString,parseText,jsoup,time +from utils.env import get_env import base64 parse = Blueprint("parse", __name__) @@ -63,6 +64,7 @@ def image(text:str): def parse_home(filename): url = getParmas('url') # http://localhost:5705/parse/api/%E6%97%A0%E5%90%8D.js?url=https://www.iqiyi.com/v_ik3832z0go.html + # http://localhost:5705/parse/api/哔哩.js?url=https://www.bilibili.com/bangumi/play/ep704873 if not url or not url.startswith('http'): return R.failed(f'url必填!{url},且必须是http开头') base_path = 'jiexi' @@ -73,12 +75,14 @@ def parse_home(filename): logger.info(f'开始尝试通过{filename}解析:{url}') jsp = jsoup(url) + env = get_env() py_ctx.update({ 'vipUrl': url, 'fetch_params': {'headers': {'Referer':url}, 'timeout': 10, 'encoding': 'utf-8'}, 'jsp':jsp, '重定向':重定向, 'toast':toast, + 'env':env, 'image':image, 'print':print, 'log':logger.info, diff --git "a/jiexi/\345\223\224\345\223\251.js" "b/jiexi/\345\223\224\345\223\251.js" new file mode 100644 index 0000000..53c3f1d --- /dev/null +++ "b/jiexi/\345\223\224\345\223\251.js" @@ -0,0 +1,91 @@ +// print(env); +// vipUrl = 'https://www.bilibili.com/bangumi/play/ep704873'; +fetch_params.headers = { + 'User-Agent':PC_UA, + "Referer": "https://www.bilibili.com", + "Cookie":env.bili_cookie||'' +}; +let appkey = env.appkey||''; +let access_key = env.access_key||''; +// print(fetch_params); + +function getEpUrl(ssUrl){ +let html = request(ssUrl); +let short_link = html.match(/short_link(.*?),/)[1]; +short_link = short_link.split(':').slice(1,-1).join('"').split('"')[1]; +let epUrl = unescape(short_link); +return epUrl +} + +function getCidEid(vipUrl){ +// print(vipUrl); +let url = vipUrl.split('?')[0]; +// print(url); +if(url.endsWith('/')){ +url = url.slice(0,-1); +} +if(url.includes('bilibili.com/video/')){ +let r = request(vipUrl); +try{ +let mtext = r.match(/window\.__INITIAL_STATE__=(.*?);\(function/)[1]; +mtext = JSON.parse(mtext); +let avid = mtext['aid']; +let bvid = mtext['bvid']; +let cid = mtext['videoData']['cid']; +return [cid,avid,bvid] +} catch (e) { +return null +} + +}else if(url.includes('/ep')){ +let epid = url.split('ep')[1]; +let data_url = 'https://api.bilibili.com/pgc/view/web/season?ep_id='+epid; +let r = JSON.parse(request(data_url)); +if(r.code === 0){ +let episodes = r['result']['episodes']; +let furl = url.replace('https://m.bilibili.com', 'https://www.bilibili.com'); +let now_ep = episodes.filter(function (it){ +return [it['short_link'], it['share_url'],it['link']].includes(furl) +})[0]; +let avid = now_ep['aid']; +let cid = now_ep['cid']; +return [cid,avid,null]; +}else{ +return null +} +}else if(url.includes('/ss')){ +let epUrl = getEpUrl(vipUrl); +return getCid(epUrl) +}else{ +return null +} +} +if(!/bilibili/.test(vipUrl)){ + realUrl = vipUrl; +}else { + try { +// print(vipUrl); + let ids = getCidEid(vipUrl); + if (Array.isArray(ids)) { + print(ids); + let cid = ids[0]; + let avid = ids[1]; + let rurl = "https://api.bilibili.com/x/player/playurl?avid=" + avid + "&cid=" + cid + "&qn=120&type=&128=128&otype=json&fnver=&fourk=1&mid=&appkey=" + appkey + "&access_key=" + access_key; + print(rurl); + try { + let r = JSON.parse(request(rurl)); + print(r); + let purl = r['data']['durl'][0]['url']; + print('purl:' + purl); + realUrl = purl; + } catch (e) { + print(e.message); + realUrl = vipUrl; + } + } else { + realUrl = vipUrl; + } + } catch (e) { + print(e.message); + } +} \ No newline at end of file diff --git "a/jiexi/\346\227\240\345\220\215.js" "b/jiexi/\346\227\240\345\220\215.js" index 6926cca..d63a0ac 100644 --- "a/jiexi/\346\227\240\345\220\215.js" +++ "b/jiexi/\346\227\240\345\220\215.js" @@ -1,4 +1,5 @@ // let jxUrl = 'http://api.ckflv.cn/?url='; +log(env); let jxUrl = 'https://k.json.icu/home/api?type=ys&uid=12406929&key=adgouwyCGIRSTUV046&url='; fetch_params.headers.Referer = jxUrl; try { diff --git "a/js/AB\345\275\261\351\231\242[\351\243\236].js" "b/js/AB\345\275\261\351\231\242[\351\243\236].js" new file mode 100644 index 0000000..0341811 --- /dev/null +++ "b/js/AB\345\275\261\351\231\242[\351\243\236].js" @@ -0,0 +1,15 @@ +var rule = { + title:'AB影院', + host:'https://abu22.com/', + url:'vodtype/fyclass-fypage.html', + searchUrl:'/search.php;**', + headers:{ 'User-Agent':'PC_UA',}, + class_name:'电影&剧集&综艺&动漫&伦理', + class_url:'1&2&4&3&40', + 推荐:'.stui-vodlist__item;*;*;*;*', + 一级:'.stui-vodlist__item;a&&title;a&&data-original;.pic-text&&Text;a&&href', + + 二级:{"title":"h3&&Text;.stui-content__detail p:eq(0)&&Text","img":".lazyload&&data-original","desc":";;;.stui-content__detail p:eq(1)&&Text;.stui-content__detail p:eq(2)&&Text","content":".stui-content__detail p:eq(5)&&Text","tabs":".stui-pannel__head.clearfix&&h3","lists":".stui-content__playlist.clearfix:eq(#id) a"}, + + 搜索:'js:let url=input.split(";")[0];let d=[];let body={searchword:input.split(";")[1]};body="searchword="+input.split(";")[1];fetch_params.body=body;let html=post(url,fetch_params);let pdfa=jsp.pdfa;let pdfh=jsp.pdfh;let pd=jsp.pd;let lists=pdfa(html,"ul.stui-vodlist__media&&li");lists.forEach(function(it){d.push({title:pdfh(it,".title&&Text"),url:pd(it,"a&&href"),desc:pdfh(html,".pic-text&&Text"),pic_url:pd(html,".lazyload&&data-original")})});setResult(d);', +} \ No newline at end of file diff --git a/js/version.txt b/js/version.txt index cf662ce..d091eba 100644 --- a/js/version.txt +++ b/js/version.txt @@ -1 +1 @@ -3.9.30beta7 \ No newline at end of file +3.9.31 \ No newline at end of file diff --git "a/js/\345\216\202\351\225\277\350\265\204\346\272\220.js" "b/js/\345\216\202\351\225\277\350\265\204\346\272\220.js" index 701240c..72341b3 100644 --- "a/js/\345\216\202\351\225\277\350\265\204\346\272\220.js" +++ "b/js/\345\216\202\351\225\277\350\265\204\346\272\220.js" @@ -1,24 +1,18 @@ var rule={ title:'厂长资源', - // host:'https://www.c-zzy.com', host:'https://czspp.com', url:'/fyclass/page/fypage', searchUrl:'/xssearch?q=**&f=_all&p=fypage', - searchable:2,//是否启用全局搜索, - quickSearch:1,//是否启用快速搜索, - filterable:0,//是否启用分类筛选, + searchable:2, + quickSearch:1, + filterable:0, headers:{'User-Agent':'PC_UA', }, - play_parse:true, - lazy:'', - limit:6, class_name:'豆瓣电影Top250&最新电影&电视剧&国产剧&美剧&韩剧&番剧&动漫', class_url:'dbtop250&zuixindianying&dsj&gcj&meijutt&hanjutv&fanju&dm', 推荐:'.bt_img;ul&&li;*;*;*;*', double:true, 一级:'.bt_img&&ul&&li;h3.dytit&&Text;img.lazy&&data-original;.jidi&&Text;a&&href', - 二级:{"title":"h1&&Text;.moviedteail_list li&&a&&Text","img":"div.dyimg img&&src","desc":".moviedteail_list li:eq(3) a&&Text;.moviedteail_list li:eq(2) a&&Text;.moviedteail_list li:eq(1) a&&Text;.moviedteail_list li:eq(7) a&&Text;.moviedteail_list li:eq(5) a&&Text","content":".yp_context&&Text","tabs":".mi_paly_box&&span","lists":".paly_list_btn:eq(#id) a"}, + 二级:{"title":"h1&&Text;.moviedteail_list li&&a&&Text","img":"div.dyimg img&&src","desc":".moviedteail_list li:eq(3) a&&Text;.moviedteail_list li:eq(2) a&&Text;.moviedteail_list li:eq(1) a&&Text;.moviedteail_list li:eq(7) a&&Text;.moviedteail_list li:eq(5) a&&Text","content":".yp_context&&Text","tabs":".mi_paly_box span","lists":".paly_list_btn:eq(#id) a"}, 搜索:'.search_list&&ul&&li;*;*;*;*', - // 预处理:'rule_fetch_params.headers.Cookie = "Hm_lvt_d06dda04a24e89e1117ee1455e217c30=1669008856; 6de728358f84bf15ea9bb771c18f37fb=b4a901c371f729a828c31d9d78def299; myannoun=1; Hm_lvt_c08e84f2c697dc9d0af77ff0dbfb3d6d=1669356917; Hm_lpvt_c08e84f2c697dc9d0af77ff0dbfb3d6d=1669357024; Hm_lpvt_d06dda04a24e89e1117ee1455e217c30=1669357024"', - 预处理:'', 预处理:'rule_fetch_params.headers.Cookie="68148872828e9f4d64e7a296f6c6b6d7=5429da9a54375db451f7f9e4f16ce0ea";let new_host="https://czspp.com";let new_html=request(new_host);if(/正在进行人机识别/.test(new_html)){let new_src=pd(new_html,"script&&src",new_host);log(new_src);let hhtml=request(new_src,{withHeaders:true});let json=JSON.parse(hhtml);let html=json.body;let key=html.match(new RegExp(\'var key="(.*?)"\'))[1];let avalue=html.match(new RegExp(\'value="(.*?)"\'))[1];let c="";for(let i=0;i