提交 e41be2c9 编写于 作者: H hjdhnx

修复初始化bug

上级 07a80446
...@@ -8,7 +8,7 @@ import muban from 'https://gitcode.net/qq_32394351/dr_py/-/raw/master/js/模板. ...@@ -8,7 +8,7 @@ import muban from 'https://gitcode.net/qq_32394351/dr_py/-/raw/master/js/模板.
function init_test(){ function init_test(){
console.log("init_test_start"); console.log("init_test_start");
console.log(RKEY); console.log(RKEY);
console.log(rule); console.log(JSON.stringify(rule));
// clearItem(RULE_CK); // clearItem(RULE_CK);
// console.log(JSON.stringify(rule)); // console.log(JSON.stringify(rule));
// console.log(request('https://www.baidu.com',{withHeaders:true})); // console.log(request('https://www.baidu.com',{withHeaders:true}));
...@@ -375,7 +375,7 @@ function homeParse(homeObj) { ...@@ -375,7 +375,7 @@ function homeParse(homeObj) {
if (html) { if (html) {
let list = pdfa(html, p[0]); let list = pdfa(html, p[0]);
if (list && list.length > 0) { if (list && list.length > 0) {
list.forEach(it => { list.forEach((it,idex) => {
try { try {
let name = pdfh(it, p[1]); let name = pdfh(it, p[1]);
if (homeObj.cate_exclude && (new RegExp(homeObj.cate_exclude).test(name))) { if (homeObj.cate_exclude && (new RegExp(homeObj.cate_exclude).test(name))) {
...@@ -392,7 +392,7 @@ function homeParse(homeObj) { ...@@ -392,7 +392,7 @@ function homeParse(homeObj) {
'type_name': name 'type_name': name
}); });
} catch (e) { } catch (e) {
console.log(e.message); console.log(`分类列表定位第${idex}个元素正常报错:${e.message}`);
} }
}); });
} }
...@@ -883,20 +883,27 @@ function playParse(playObj){ ...@@ -883,20 +883,27 @@ function playParse(playObj){
rule.cate_exclude = rule_cate_excludes.join('|'); rule.cate_exclude = rule_cate_excludes.join('|');
rule.tab_exclude = rule_tab_excludes.join('|'); rule.tab_exclude = rule_tab_excludes.join('|');
rule.host = rule.host||''; rule.host = (rule.host||'').rstrip('/');
rule.url = rule.url||''; rule.url = rule.url||'';
rule.double = rule.double||false;
rule.homeUrl = rule.homeUrl||''; rule.homeUrl = rule.homeUrl||'';
rule.searchUrl = rule.searchUrl||''; rule.searchUrl = rule.searchUrl||'';
if(rule.headers && typeof(rule.headers) === 'object'){ if(rule.headers && typeof(rule.headers) === 'object'){
let header_keys = Object.keys(rule.headers); try {
for(let k of header_keys){ let header_keys = Object.keys(rule.headers);
if(k.toLowerCase() === 'user-agent'){ for(let k of header_keys){
let v = header_keys[k]; if(k.toLowerCase() === 'user-agent'){
if(['MOBILE_UA','PC_UA','UC_UA','IOS_UA','UA'].includes(v)){ let v = rule.headers[k];
rule.headers[k] = eval(v); console.log(v);
if(['MOBILE_UA','PC_UA','UC_UA','IOS_UA','UA'].includes(v)){
rule.headers[k] = eval(v);
}
} }
} }
}catch (e) {
console.log('处理headers发生错误:'+e.message);
} }
} }
RKEY = typeof(key)!=='undefined'&&key?key:'drpy_' + (rule.title || rule.host); RKEY = typeof(key)!=='undefined'&&key?key:'drpy_' + (rule.title || rule.host);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册