diff --git a/controllers/parse.py b/controllers/parse.py index 5f89c13a8e1310b4bf687acb95ce2fb13194ba3b..8bcafcae04e474d8c7efbf73e10c2245f7e539e9 100644 --- a/controllers/parse.py +++ b/controllers/parse.py @@ -3,7 +3,7 @@ # File : parse.py # Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------ # Date : 2022/9/24 -from flask import Blueprint, jsonify +from flask import Blueprint, jsonify,redirect from utils.web import getParmas,get_interval import os from utils.log import logger @@ -37,6 +37,14 @@ class R(object): def failed(self,msg="系统异常", code=404,extra=None): return self.error(msg,code,extra) +def 重定向(url:str): + if isinstance(url, PyJsString): + url = parseText(str(url)) + if str(url).startswith('http'): + return f'redirect://{url}' + else: + return str(url) + @parse.route('/api/') def parse_home(filename): url = getParmas('url') @@ -50,11 +58,14 @@ def parse_home(filename): return R.failed(f'{file_path}文件不存在') logger.info(f'开始尝试通过{filename}解析:{url}') + + jsp = jsoup(url) py_ctx.update({ 'vipUrl': url, 'fetch_params': {'headers': {'Referer':url}, 'timeout': 10, 'encoding': 'utf-8'}, - 'jsp':jsp + 'jsp':jsp, + '重定向':重定向 }) ctx = py_ctx with open(file_path,encoding='utf-8') as f: @@ -69,6 +80,9 @@ def parse_home(filename): return R.failed(f'解析失败:{realUrl}') if isinstance(realUrl, PyJsString): realUrl = parseText(str(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)}毫秒'}) except Exception as e: msg = f'{filename}解析出错:{e}' diff --git "a/jiexi/\346\261\237\346\271\226.js" "b/jiexi/\346\261\237\346\271\226.js" new file mode 100644 index 0000000000000000000000000000000000000000..24985bb52204dc43eaaecdda3453a6cb3608ecd2 --- /dev/null +++ "b/jiexi/\346\261\237\346\271\226.js" @@ -0,0 +1 @@ +realUrl = 重定向('http://211.99.99.236:4567/jhjson/ceshi.php?url='+vipUrl) \ No newline at end of file diff --git a/js/version.txt b/js/version.txt index ad6413176af3cb8ea3005dc7ec01c9e65a06eaa4..b44c537057f685e2ea83ae14a6aec981903f6ef2 100644 --- a/js/version.txt +++ b/js/version.txt @@ -1 +1 @@ -3.7.11 \ No newline at end of file +3.7.12 \ No newline at end of file diff --git "a/js/\350\247\243\346\236\220.conf" "b/js/\350\247\243\346\236\220.conf" index 29a8dc5c88c7520d8468cc67e01b940b3c3ac859..71880fd32abd7c6bdc6b8ed5e1e56a2a4a733d6c 100644 --- "a/js/\350\247\243\346\236\220.conf" +++ "b/js/\350\247\243\346\236\220.conf" @@ -13,7 +13,7 @@ BT5V,https://rx.bt5v.com/json/jsonindex.php/?url=,1 # 查询,https://chaxun.truechat365.com/?url= # 这个解析真的牛逼,只能电脑看 # llq,https://hc.izny.cn/json.php?url=,1 -江湖,http://211.99.99.236:4567/jhjson/ceshi.php?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 diff --git a/readme.md b/readme.md index 14aa0c574f83687233b3872c4acfa8baa89b864c..c7a0398a236e70c4075aa06d4dde34d8d06d87b7 100644 --- a/readme.md +++ b/readme.md @@ -50,6 +50,7 @@ - [X] 1.v3.7.10 增加了自定义解析功能,解析.conf支持变量{{host}} - [X] 2.新增了 jiexi/无名.js作为示例,接受vipUrl返回realUrl - [X] 3.修复腾云驾雾并增加通用筛选 +- [X] 4.自建解析增加重定向方法,方便明面上隐藏真实来源的解析地址 ###### 2022/09/23 - [X] 1.v3.7.5 优化了首图2模板的搜索定位以及几个相关的源 - [X] 2.二级渲染功能拆分,js单独调用