提交 a0062877 编写于 作者: H hjdhnx

解析优化

上级 7a332bda
......@@ -80,11 +80,13 @@ def parse_home(filename):
return R.failed(f'解析失败:{realUrl}')
if isinstance(realUrl, PyJsString):
realUrl = parseText(str(realUrl))
if not realUrl or realUrl == url:
return R.failed(f'解析失败',extra={'from':realUrl})
# print(realUrl)
if str(realUrl).startswith('redirect://'):
return redirect(realUrl.split('redirect://')[1])
return R.success(f'{filename}解析成功',realUrl,{'time':f'{get_interval(t1)}毫秒'})
return R.success(f'{filename}解析成功',realUrl,{'time':f'{get_interval(t1)}毫秒','from':url})
except Exception as e:
msg = f'{filename}解析出错:{e}'
logger.info(msg)
return R.failed(msg,extra={'time':f'{get_interval(t1)}毫秒'})
\ No newline at end of file
return R.failed(msg,extra={'time':f'{get_interval(t1)}毫秒','from':url})
\ No newline at end of file
let jxUrl = 'http://api.kunyu77.com/api.php/provide/parserUrl?url=';
fetch_params.headers.Referer = jxUrl;
fetch_params.headers['User-Agent'] = "Dalvik/2.1.0";
try {
// realUrl = null;
let html = request(jxUrl+vipUrl);
log(html);
realUrl = jsp.pjfh(html,'$..url');
realUrl = 重定向(realUrl);
log('解析到真实播放地址:'+realUrl);
}catch (e) {
log('解析发生错误:'+e.message);
realUrl = vipUrl;
}
\ No newline at end of file
let jxUrl = 'https://h5.freejson.xyz/player/analysis.php?v=';
fetch_params.headers.Referer = jxUrl;
try {
// realUrl = null;
let html = request(jxUrl+vipUrl);
log(html);
//realUrl = jsp.pjfh(html,'$..url');
realUrl=html.match(/var urls = "(.*?)"/)[1];
log('解析到真实播放地址:'+realUrl);
}catch (e) {
log('解析发生错误:'+e.message);
realUrl = vipUrl;
}
\ No newline at end of file
......@@ -102,8 +102,8 @@ def jxTxt2Json(text:str,host:str):
jxs.append({
'name':dt[0],
'url':dt[1],
'type':dt[2] if len(dt) > 2 else 0,
'ua':dt[3] if len(dt) > 3 else UA,
'type':dt[2] if len(dt) > 2 and dt[2] else 0,
'ua':dt[3] if len(dt) > 3 and dt[3] else UA,
})
except Exception as e:
logger.info(f'解析行有错误:{e}')
......@@ -120,9 +120,20 @@ def getJxs(path='js',host=None):
虾米,https://dm.xmflv.com:4433/?url=
"""
f1.write(msg)
base_path = 'jiexi' # 自建解析目录
os.makedirs(base_path, exist_ok=True)
file_name = os.listdir(base_path)
file_name = list(filter(lambda x: str(x).endswith('.js') and str(x).find('模板') < 0, file_name))
# print(file_name)
jx_list = [file.replace('.js', '') for file in file_name]
# print(file_name)
# print(jx_list)
jx_str = '\n'.join([jx+',{{host}}'+f'/parse/api/{jx}.js?url=,1' for jx in jx_list])
# print(jx_str)
with open(f'{path}/解析.conf',encoding='utf-8') as f:
text = f.read()
text = jx_str + '\n' + text
jxs = jxTxt2Json(text,host)
with open(custom_jx,encoding='utf-8') as f2:
text = f2.read()
......
# 0123,对应,普通解析,json解析,并发多json解析,聚合解析,参数3不填默认0
# flags是线路名称标识,会自动拦截并走以下的解析
# 名称,链接,类型,ua (ua不填默认 Mozilla/5.0) 可以手动填 Dart/2.14 (dart:io)
轮询,Sequence,2
并发,Parallel,2
# 轮询,Sequence,2
# 并发,Parallel,2
# 聚合,Demo,3
# 快看,http://api.8a5.cn/parse/kuaikan/de.php?url=,1
# 钢铁侠,https://json.freejx.in/?url=,1
# 绿叶,https://hc.izny.cn/json.php?url=,1
# 无名1,http://api.ckflv.cn/?url=,1
无名1,{{host}}/parse/api/无名.js?url=,1
# 无名1,{{host}}/parse/api/无名.js?url=,1
91,http://91fanli.top/m3u8/?url=
BT5V,https://rx.bt5v.com/json/jsonindex.php/?url=,1
# 查询,https://chaxun.truechat365.com/?url= # 这个解析真的牛逼,只能电脑看
# llq,https://hc.izny.cn/json.php?url=,1
江湖,{{host}}/parse/api/江湖.js?url=,1
# 江湖,{{host}}/parse/api/江湖.js?url=,1
左岸,https://jx.bozrc.com:4433/player/?url=
GGTV搜集,https://play.fuqizhishi.com/juhe/API.php?appkey=caijijuhe220902&url=,1,
CY,https://vip.cyu0.cn/home/api?type=ys&uid=1353484&key=efopqwABCLOTVYZ278&url=,1
......
......@@ -51,6 +51,22 @@
"header": {
"User-Agent": "Mozilla/5.0"
}
},
{
"name": "轮询",
"type": 2,
"url": "Sequence",
"header": {
"User-Agent": "Mozilla/5.0"
}
},
{
"name": "并发",
"type": 2,
"url": "Parallel",
"header": {
"User-Agent": "Mozilla/5.0"
}
},
{% for jx in jxs %}
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册