发布新版本,支持后台配置rules

This commit is contained in:
晚风拂柳颜 2023-07-03 10:08:06 +08:00
parent f946764030
commit 70420eccdd
7 changed files with 35 additions and 154 deletions

View File

@ -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="]}]'

View File

@ -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:

View File

@ -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]

View File

@ -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

View File

@ -1 +1 @@
3.9.45beta2
3.9.45beta3

View File

@ -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",

View File

@ -79,6 +79,7 @@
layer.prompt({
formType: 2,
value: value,
maxlength:20480,//最大输入长度20kb
title: '请输入 '+key,
area: ['320px', '100px'] //自定义文本域宽高
}, function(value, index, elem){