diff --git a/base/config.py b/base/config.py index c2ed27a..fea85e1 100644 --- a/base/config.py +++ b/base/config.py @@ -60,3 +60,4 @@ THREAD = True # 开启windows多线程调用 GEVENT = True # windows开启此参数就不走gevent,方便调试 SPECIAL = '腾云驾雾:腾讯&奇珍异兽:爱奇艺&百忙无果:芒果&优酷&哔哩影视&Alist&CMS_非凡资源:非凡&CMS_量子资源:量子' # 特殊优选 SPIDER_JAR = 'custom_spider_qy0627.jar' +EXT_FUNC = '[{"host":"ss.rongliren.com","rule":["m3u8?id="]},{"host":"hei17.com","rule":["img.hei17.com","storage/uploads/",".m3u8$"]},{"name":"量子","hosts":["vip.lz","hd.lz"],"regex":["#EXT-X-DISCONTINUITY\\\\r*\\\\n*#EXTINF:6.433333,[\\\\s\\\\S]*?#EXT-X-DISCONTINUITY"]},{"name":"非凡","hosts":["vip.ffzy","hd.ffzy"],"regex":["#EXT-X-DISCONTINUITY\\\\r*\\\\n*#EXTINF:6.666667,[\\\\s\\\\S]*?#EXT-X-DISCONTINUITY"]},{"host":"piaku.cc","rule":[".mp4",".m3u8","?auth_token","m3u8"]},{"host":"v.3412.net.cn","rule":[".mp4","security-token=","aliyuncs.com","m3u8"]},{"host":"jx.jsonplayer.com","rule":[".mp4",".m3u8","?vkey=","110.42.2.115","m3u8"]},{"host":"movie.bulei.cc","rule":[".mp4",".m3u8","?vkey=","1ftn_handler","http://1.71.18.153","mu.dcd1.cn","aliyundrive.net","m3u8"]},{"host":"rebozj.pro","rule":[".mp4",".m3u8","https://p3-sign.douyinpic.com","m3u8"]},{"host":"brovod.com","rule":[".m3u8"]},{"host":"https://www1.gntv.live","rule":[".m3u8","m3u8?","4k.clyjx.cn:97"]},{"host":"renren.pro","rule":[".m3u8"]},{"host":"https://v.3412.net.cn","rule":[".m3u8",".m3u8?",".mp4"]},{"host":"v.t-ui.cn","rule":[".m3u8","m3u8?","vip.ffzy-play4.com"]},{"host":"cj.ffzyapi.com","rule":[".m3u8","m3u8?"]},{"host":"siguyy.com","rule":["mp4",".m3u8","https://ccp-bj29-video-preview.oss-enet.aliyuncs.com","aliyuncs.com"]},{"name":"火山嗅探","hosts":["huoshan.com"],"regex":["item_id="]},{"name":"抖音嗅探","hosts":["douyin.com"],"regex":["is_play_url="]}]' \ No newline at end of file diff --git a/controllers/home.py b/controllers/home.py index c071a1b..ec3ae16 100644 --- a/controllers/home.py +++ b/controllers/home.py @@ -277,6 +277,16 @@ def config_render(mode): rules = getRules('js',js_mode) rules = get_multi_rules(rules) # html = render_template('config.txt',rules=getRules('js'),host=host,mode=mode,jxs=jxs,base64Encode=base64Encode,config=new_conf) + if new_conf.EXT_FUNC and new_conf.EXT_FUNC.strip(): + try: + new_conf.EXT_FUNC = json.loads(new_conf.EXT_FUNC) + logger.info(f'扩展规则加载成功,共计:{len(new_conf.EXT_FUNC)}') + except Exception as e: + logger.info(f'加载扩展规则发生错误:{e}') + new_conf.EXT_FUNC = [] + else: + new_conf.EXT_FUNC = [] + html = render_template('config.txt',js0_password=js0_password,UA=UA,xr_mode=xr_mode,ISTVB=ISTVB,pys=pys,rules=rules,host=host,mode=mode,js_mode=js_mode,jxs=jxs,alists=alists,alists_str=alists_str,live_url=live_url,config=new_conf) merged_config = custom_merge(parseText(html),customConfig) # print(merged_config['sites']) @@ -427,6 +437,15 @@ def config_gen(): lsg = storage_service() store_conf_dict = lsg.getStoreConfDict() new_conf.update(store_conf_dict) + if new_conf.EXT_FUNC and new_conf.EXT_FUNC.strip(): + try: + new_conf.EXT_FUNC = json.loads(new_conf.EXT_FUNC) + logger.info(f'扩展规则加载成功,共计:{len(new_conf.EXT_FUNC)}') + except Exception as e: + logger.info(f'加载扩展规则发生错误:{e}') + new_conf.EXT_FUNC = [] + else: + new_conf.EXT_FUNC = [] try: use_py = lsg.getItem('USE_PY') js_mode = int(new_conf.JS_MODE or 0) @@ -438,15 +457,15 @@ def config_gen(): rules = get_multi_rules(rules) host0 = getHost(0) jxs = getJxs(host=host0) - set_local = render_template('config.txt',js0_password=js0_password,pys=pys,rules=rules,alists=alists,alists_str=alists_str,live_url=get_live_url(new_conf,0),mode=0,js_mode=js_mode,host=host0,jxs=jxs) + set_local = render_template('config.txt',js0_password=js0_password,pys=pys,rules=rules,alists=alists,alists_str=alists_str,live_url=get_live_url(new_conf,0),mode=0,js_mode=js_mode,host=host0,jxs=jxs,config=new_conf) # print(set_local) host1 = getHost(1) jxs = getJxs(host=host1) - set_area = render_template('config.txt',js0_password=js0_password,pys=pys,rules=rules,alists=alists,alists_str=alists_str,live_url=get_live_url(new_conf,1),mode=1,js_mode=js_mode,host=host1,jxs=jxs) + set_area = render_template('config.txt',js0_password=js0_password,pys=pys,rules=rules,alists=alists,alists_str=alists_str,live_url=get_live_url(new_conf,1),mode=1,js_mode=js_mode,host=host1,jxs=jxs,config=new_conf) host2 = getHost(2) or host1 # print('远程地址:'+host2) jxs = getJxs(host=host2) - set_online = render_template('config.txt',js0_password=js0_password,pys=pys,rules=rules,alists=alists,alists_str=alists_str,live_url=get_live_url(new_conf,2),mode=1,js_mode=js_mode,host=host2,jxs=jxs) + set_online = render_template('config.txt',js0_password=js0_password,pys=pys,rules=rules,alists=alists,alists_str=alists_str,live_url=get_live_url(new_conf,2),mode=1,js_mode=js_mode,host=host2,jxs=jxs,config=new_conf) ali_token = new_conf.ALI_TOKEN # parses = [] with open('txt/pycms0.json','w+',encoding='utf-8') as f: diff --git a/controllers/service.py b/controllers/service.py index a2406b7..b2db1f5 100644 --- a/controllers/service.py +++ b/controllers/service.py @@ -26,7 +26,7 @@ class storage_service(object): 'LAZYPARSE_MODE', 'WALL_PAPER_ENABLE', 'WALL_PAPER', 'UNAME', 'PWD', 'LIVE_MODE', 'CATE_EXCLUDE', 'TAB_EXCLUDE', 'SEARCH_TIMEOUT', 'SEARCH_LIMIT', 'MULTI_MODE', 'XR_MODE', 'JS_PROXY', 'UPDATE_PROXY', 'ENV', 'ALI_TOKEN', 'OCR_API', - 'SPECIAL','SPIDER_JAR'] + 'SPECIAL','SPIDER_JAR', 'EXT_FUNC'] for conf in conf_list: if not self.hasItem(conf): print(f'开始初始化{conf}') @@ -38,11 +38,11 @@ class storage_service(object): conf_list = ['LIVE_URL', 'LIVE_MODE', 'PLAY_URL', 'PID_URL', 'USE_PY', 'JS_MODE', 'JS0_DISABLE', 'JS0_PASSWORD', 'PLAY_DISABLE', 'LAZYPARSE_MODE', 'WALL_PAPER_ENABLE', 'WALL_PAPER', 'UNAME', 'PWD', 'CATE_EXCLUDE', 'TAB_EXCLUDE', 'SEARCH_TIMEOUT', 'SEARCH_LIMIT', - 'MULTI_MODE', 'XR_MODE', 'JS_PROXY', 'UPDATE_PROXY', 'ENV', 'SPECIAL', 'SPIDER_JAR', 'ALI_TOKEN', 'OCR_API'] + 'MULTI_MODE', 'XR_MODE', 'JS_PROXY', 'UPDATE_PROXY', 'ENV', 'SPECIAL', 'SPIDER_JAR', 'EXT_FUNC', 'ALI_TOKEN', 'OCR_API'] conf_name_list = ['直播地址', '直播模式', '远程地址', '进程管理链接', '启用py源', 'js模式', '禁用js0', 'js0密码', '禁用免嗅', '免嗅模式', '启用壁纸', '壁纸链接', '管理账号', '管理密码', '分类排除', '线路排除', '聚搜超时', '搜索条数', '多源模式', '仙人模式', '源代理', - '升级代理', '环境变量', '优选源', '挂载JAR', '阿里tk', 'OCR接口'] + '升级代理', '环境变量', '优选源', '挂载JAR', '辅助规则', '阿里tk', 'OCR接口'] conf_lists = [] for i in range(len(conf_list)): conf = conf_list[i] diff --git a/doc/更新日志.md b/doc/更新日志.md index f70e3f1..4f483e2 100644 --- a/doc/更新日志.md +++ b/doc/更新日志.md @@ -1,3 +1,9 @@ +###### 2023/07/03 +- [X] 后台管理增加辅助规则配置项用于配置rules,自己手动去兼容新老壳子,示例如下(hosts和regex去广告老壳子不支持): +```json + [{"host":"ss.rongliren.com","rule":["m3u8?id="]},{"host":"hei17.com","rule":["img.hei17.com","storage/uploads/",".m3u8$"]},{"name":"量子","hosts":["vip.lz","hd.lz"],"regex":["#EXT-X-DISCONTINUITY\\r*\\n*#EXTINF:6.433333,[\\s\\S]*?#EXT-X-DISCONTINUITY"]},{"name":"非凡","hosts":["vip.ffzy","hd.ffzy"],"regex":["#EXT-X-DISCONTINUITY\\r*\\n*#EXTINF:6.666667,[\\s\\S]*?#EXT-X-DISCONTINUITY"]},{"host":"piaku.cc","rule":[".mp4",".m3u8","?auth_token","m3u8"]},{"host":"v.3412.net.cn","rule":[".mp4","security-token=","aliyuncs.com","m3u8"]},{"host":"jx.jsonplayer.com","rule":[".mp4",".m3u8","?vkey=","110.42.2.115","m3u8"]},{"host":"movie.bulei.cc","rule":[".mp4",".m3u8","?vkey=","1ftn_handler","http://1.71.18.153","mu.dcd1.cn","aliyundrive.net","m3u8"]},{"host":"rebozj.pro","rule":[".mp4",".m3u8","https://p3-sign.douyinpic.com","m3u8"]},{"host":"brovod.com","rule":[".m3u8"]},{"host":"https://www1.gntv.live","rule":[".m3u8","m3u8?","4k.clyjx.cn:97"]},{"host":"renren.pro","rule":[".m3u8"]},{"host":"https://v.3412.net.cn","rule":[".m3u8",".m3u8?",".mp4"]},{"host":"v.t-ui.cn","rule":[".m3u8","m3u8?","vip.ffzy-play4.com"]},{"host":"cj.ffzyapi.com","rule":[".m3u8","m3u8?"]},{"host":"siguyy.com","rule":["mp4",".m3u8","https://ccp-bj29-video-preview.oss-enet.aliyuncs.com","aliyuncs.com"]},{"name":"火山嗅探","hosts":["huoshan.com"],"regex":["item_id="]},{"name":"抖音嗅探","hosts":["douyin.com"],"regex":["is_play_url="]}] +``` + ###### 2023/06/30 - [X] 后台管理增加jar文件切换,文件放在libs/jar目录即可 - [X] 3.9.45beta1 diff --git a/js/version.txt b/js/version.txt index 896c2cb..17675f8 100644 --- a/js/version.txt +++ b/js/version.txt @@ -1 +1 @@ -3.9.45beta2 \ No newline at end of file +3.9.45beta3 \ No newline at end of file diff --git a/templates/config.txt b/templates/config.txt index 5f65357..691ee31 100644 --- a/templates/config.txt +++ b/templates/config.txt @@ -272,153 +272,7 @@ ] } ], -"rules":[ -{ -"host":"ss.rongliren.com", -"rule":["m3u8\?id="], -},{ -"host":"hei17.com", -"rule":["img\.hei17\.com","storage/uploads/","\.m3u8$"], -},{ - "name": "量子", - "hosts": [ - "vip.lz", - "hd.lz" - ], - "regex": [ - "#EXT-X-DISCONTINUITY\\r*\\n*#EXTINF:6.433333,[\\s\\S]*?#EXT-X-DISCONTINUITY" - ] - }, - { - "name": "非凡", - "hosts": [ - "vip.ffzy", - "hd.ffzy" - ], - "regex": [ - "#EXT-X-DISCONTINUITY\\r*\\n*#EXTINF:6.666667,[\\s\\S]*?#EXT-X-DISCONTINUITY" - ] - }, - { - "host": "piaku.cc", - "rule": [ - ".mp4", - ".m3u8", - "?auth_token", - "m3u8" - ] - }, - { - "host": "v.3412.net.cn", - "rule": [ - ".mp4", - "security-token=", - "aliyuncs.com", - "m3u8" - ] - }, - { - "host": "jx.jsonplayer.com", - "rule": [ - ".mp4", - ".m3u8", - "?vkey=", - "110.42.2.115", - "m3u8" - ] - }, - { - "host": "movie.bulei.cc", - "rule": [ - ".mp4", - ".m3u8", - "?vkey=", - "1ftn_handler", - "http://1.71.18.153", - "mu.dcd1.cn", - "aliyundrive.net", - "m3u8" - ] - }, - { - "host": "rebozj.pro", - "rule": [ - ".mp4", - ".m3u8", - "https://p3-sign.douyinpic.com", - "m3u8" - ] - }, - { - "host": "brovod.com", - "rule": [ - ".m3u8" - ] - }, - { - "host": "https://www1.gntv.live", - "rule": [ - ".m3u8", - "m3u8?", - "4k.clyjx.cn:97" - ] - }, - { - "host": "renren.pro", - "rule": [ - ".m3u8" - ] - }, - { - "host": "https://v.3412.net.cn", - "rule": [ - ".m3u8", - ".m3u8?", - ".mp4" - ] - }, - { - "host": "v.t-ui.cn", - "rule": [ - ".m3u8", - "m3u8?", - "vip.ffzy-play4.com" - ] - }, - { - "host": "cj.ffzyapi.com", - "rule": [ - ".m3u8", - "m3u8?" - ] - }, - { - "host": "siguyy.com", - "rule": [ - "mp4", - ".m3u8", - "https://ccp-bj29-video-preview.oss-enet.aliyuncs.com", - "aliyuncs.com" - ] - }, - { - "name": "火山嗅探", - "hosts": [ - "huoshan.com" - ], - "regex": [ - "item_id=" - ] - }, - { - "name": "抖音嗅探", - "hosts": [ - "douyin.com" - ], - "regex": [ - "is_play_url=" - ] - }], +"rules":{{config.EXT_FUNC or []}}, "ads": [ "mimg.0c1q0l.cn", "www.googletagmanager.com", diff --git a/templates/settings.html b/templates/settings.html index b3c2e4d..0fb2fab 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -79,6 +79,7 @@ layer.prompt({ formType: 2, value: value, + maxlength:20480,//最大输入长度20kb title: '请输入 '+key, area: ['320px', '100px'] //自定义文本域宽高 }, function(value, index, elem){