提交 204c2ce6 编写于 作者: H hjdhnx

新增继承属性 模板:

上级 a8855c0e
......@@ -163,6 +163,7 @@ def vod_home():
with open('js/模板.js', encoding='utf-8') as f:
before = f.read().split('export')[0]
# logger.info(f'js读取耗时:{get_interval(t1)}毫秒')
end_code = """\nif (rule.模板 && muban.hasOwnProperty(rule.模板)) {rule = Object.assign(muban[rule.模板], rule);}"""
logger.info(f'参数检验js读取共计耗时:{get_interval(t0)}毫秒')
t2 = time()
......@@ -178,7 +179,8 @@ def vod_home():
try:
with open(js_path,encoding='utf-8') as f2:
jscode = f2.read()
jscode = before + jscode
jscode = before + jscode + end_code
# print(jscode)
ctx.eval(jscode)
js_ret = ctx.get('rule')
ruleDict = ujson.loads(js_ret.json())
......@@ -188,6 +190,7 @@ def vod_home():
# print(type(ruleDict))
# print(ruleDict)
# print(ruleDict)
ruleDict['id'] = rule # 把路由请求的id装到字典里,后面播放嗅探才能用
# print(ruleDict)
# print(rule)
......
var rule = Object.assign(muban.mxpro,{
var rule = {
title:'cokemv',
模板:'mxpro',
host:'https://cokemv.me',
class_parse:'.navbar-items li:gt(1):lt(7);a&&Text;a&&href;/(\\d+).html',
});
\ No newline at end of file
}
\ No newline at end of file
......@@ -113,7 +113,7 @@ def getRules(path='cache',js_mode=0):
js = js_path[i]
with open(js,encoding='utf-8') as f:
code = f.read()
new_code = 'var muban = JSON.parse(JSON.stringify(mubanDict));\n'+code.replace('rule',f'rule{i}',1)
new_code = 'var muban = JSON.parse(JSON.stringify(mubanDict));\n'+code.replace('rule',f'rule{i}',1)+f'\nif (rule{i}.模板 && muban.hasOwnProperty(rule{i}.模板))'+'{'+f'rule{i} = Object.assign(muban[rule{i}.模板], rule{i});'+'}'
# new_code = ''+code.replace('rule',f'rule{i}',1)
codes.append(new_code)
newCodes = before + '\n'+ '\n'.join(codes)
......
......@@ -1708,8 +1708,8 @@ function playParse(playObj){
let muban = eval(globalThis.mubanJs);
if (typeof ext == 'object'){
rule = ext;
if (rule.template) {
rule = Object.assign(muban[rule.template], rule);
if (rule.模板 && muban.hasOwnProperty(rule.模板)) {
rule = Object.assign(muban[rule.模板], rule);
}
} else if (typeof ext == 'string') {
if (ext.startsWith('http')) {
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册