From f0e9ac68b2c853ae2293ed76adcdc16a5815293d Mon Sep 17 00:00:00 2001 From: hjdhnx Date: Sun, 25 Sep 2022 12:12:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=BB=BA=E9=9A=90?= =?UTF-8?q?=E8=97=8F=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/parse.py | 18 ++++++++++++++++-- "jiexi/\346\261\237\346\271\226.js" | 1 + js/version.txt | 2 +- "js/\350\247\243\346\236\220.conf" | 2 +- readme.md | 1 + 5 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 "jiexi/\346\261\237\346\271\226.js" diff --git a/controllers/parse.py b/controllers/parse.py index 5f89c13..8bcafca 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 0000000..24985bb --- /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 ad64131..b44c537 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 29a8dc5..71880fd 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 14aa0c5..c7a0398 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单独调用 -- GitLab