Add files via upload
This commit is contained in:
parent
0d8c1f480c
commit
f4bc35dae8
@ -264,7 +264,7 @@ function pre() {
|
||||
|
||||
let rule = {};
|
||||
let vercode = typeof (pdfl) === 'function' ? 'drpy2.1' : 'drpy2';
|
||||
const VERSION = vercode + ' 3.9.50beta28 20240610';
|
||||
const VERSION = vercode + ' 3.9.50beta29 20240613';
|
||||
/** 已知问题记录
|
||||
* 1.影魔的jinjia2引擎不支持 {{fl}}对象直接渲染 (有能力解决的话尽量解决下,支持对象直接渲染字符串转义,如果加了|safe就不转义)[影魔牛逼,最新的文件发现这问题已经解决了]
|
||||
* Array.prototype.append = Array.prototype.push; 这种js执行后有毛病,for in 循环列表会把属性给打印出来 (这个大毛病需要重点排除一下)
|
||||
@ -1843,7 +1843,7 @@ function homeParse(homeObj) {
|
||||
if (is_json) {
|
||||
try {
|
||||
let cms_cate_url = homeObj.MY_URL.replace('ac=detail', 'ac=list');
|
||||
let html = getHtml(cms_cate_url);
|
||||
let html = homeObj.home_html || getHtml(cms_cate_url);
|
||||
if (html) {
|
||||
if (cms_cate_url === homeObj.MY_URL) {
|
||||
homeHtmlCache = html;
|
||||
@ -1858,7 +1858,7 @@ function homeParse(homeObj) {
|
||||
}
|
||||
} else if (p.length >= 3 && !is_json) { // 可以不写正则
|
||||
try {
|
||||
let html = getHtml(homeObj.MY_URL);
|
||||
let html = homeObj.home_html || getHtml(homeObj.MY_URL);
|
||||
if (html) {
|
||||
homeHtmlCache = html;
|
||||
let list = _pdfa(html, p0);
|
||||
@ -1871,7 +1871,7 @@ function homeParse(homeObj) {
|
||||
}
|
||||
// let url = pdfh(it, p[2]);
|
||||
let url = _pd(it, p[2]);
|
||||
if (p.length > 3 && p[3]) {
|
||||
if (p.length > 3 && p[3] && !homeObj.home_html) {
|
||||
let exp = new RegExp(p[3]);
|
||||
url = url.match(exp)[1];
|
||||
}
|
||||
@ -3130,6 +3130,52 @@ function init(ext) {
|
||||
// eval("(function(){'use strict';"+ext.replace('var rule', 'rule')+"})()");
|
||||
eval("(function(){" + ext.replace('var rule', 'rule') + "})()");
|
||||
}
|
||||
} else {
|
||||
console.log(`规则加载失败,不支持的规则类型:${typeof ext}`);
|
||||
return
|
||||
}
|
||||
rule.host = (rule.host || '').rstrip('/');
|
||||
HOST = rule.host;
|
||||
if (rule.hostJs) {
|
||||
console.log(`检测到hostJs,准备执行...`);
|
||||
try {
|
||||
eval(rule.hostJs);
|
||||
rule.host = HOST.rstrip('/');
|
||||
} catch (e) {
|
||||
console.log(`执行${rule.hostJs}获取host发生错误:` + e.message);
|
||||
}
|
||||
}
|
||||
if (rule['模板'] === '自动') {
|
||||
try {
|
||||
let host_headers = rule['headers'] || {};
|
||||
let host_html = getCode(HOST, {headers: host_headers});
|
||||
let match_muban = '';
|
||||
let muban_keys = Object.keys(muban).filter(it => !/默认|短视2|采集1/.test(it));
|
||||
for (let muban_key of muban_keys) {
|
||||
try {
|
||||
let host_data = JSON.parse(home({}, host_html, muban[muban_key].class_parse));
|
||||
if (host_data.class && host_data.class.length > 0) {
|
||||
match_muban = muban_key;
|
||||
console.log(`自动匹配模板:【${muban_key}】`);
|
||||
break;
|
||||
}
|
||||
} catch (e) {
|
||||
// @ts-ignore
|
||||
console.log(`自动匹配模板:【${muban_key}】错误:${e.message}`);
|
||||
}
|
||||
}
|
||||
if (match_muban) {
|
||||
muban['自动'] = muban[match_muban];
|
||||
if (rule['模板修改'] && rule['模板修改'].startsWith('js:')) {
|
||||
// 模板修改:$js.toString(()=>{ muban.自动.class_parse = ''});
|
||||
eval(rule['模板修改'].replace('js:', '').trim());
|
||||
}
|
||||
} else {
|
||||
delete rule['模板']
|
||||
}
|
||||
} catch (e) {
|
||||
delete rule['模板']
|
||||
}
|
||||
}
|
||||
if (rule.模板 && muban.hasOwnProperty(rule.模板)) {
|
||||
print('继承模板:' + rule.模板);
|
||||
@ -3143,17 +3189,7 @@ function init(ext) {
|
||||
|
||||
rule.cate_exclude = rule_cate_excludes.join('|');
|
||||
rule.tab_exclude = rule_tab_excludes.join('|');
|
||||
rule.host = (rule.host || '').rstrip('/');
|
||||
HOST = rule.host;
|
||||
if (rule.hostJs) {
|
||||
console.log(`检测到hostJs,准备执行...`);
|
||||
try {
|
||||
eval(rule.hostJs);
|
||||
rule.host = HOST.rstrip('/');
|
||||
} catch (e) {
|
||||
console.log(`执行${rule.hostJs}获取host发生错误:` + e.message);
|
||||
}
|
||||
}
|
||||
|
||||
rule.类型 = rule.类型 || '影视'; // 影视|听书|漫画|小说
|
||||
rule.url = rule.url || '';
|
||||
rule.double = rule.double || false;
|
||||
@ -3246,10 +3282,14 @@ let homeHtmlCache = undefined;
|
||||
/**
|
||||
* js源获取首页分类和筛选特定返回对象中的函数
|
||||
* @param filter 筛选条件字典对象
|
||||
* @param home_html 指定了源码。无需内部再请求
|
||||
* @param class_parse 自动匹配传入的模板的动态分类
|
||||
* @returns {string}
|
||||
*/
|
||||
function home(filter) {
|
||||
function home(filter, home_html, class_parse) {
|
||||
console.log("home");
|
||||
home_html = home_html || '';
|
||||
class_parse = class_parse || '';
|
||||
if (typeof (rule.filter) === 'string' && rule.filter.trim().length > 0) {
|
||||
try {
|
||||
let filter_json = ungzip(rule.filter.trim());
|
||||
@ -3263,8 +3303,9 @@ function home(filter) {
|
||||
MY_URL: rule.homeUrl,
|
||||
class_name: rule.class_name || '',
|
||||
class_url: rule.class_url || '',
|
||||
class_parse: rule.class_parse || '',
|
||||
class_parse: class_parse || rule.class_parse || '',
|
||||
cate_exclude: rule.cate_exclude,
|
||||
home_html: home_html,
|
||||
};
|
||||
return homeParse(homeObj);
|
||||
}
|
||||
|
2
JN/dr_py/libs/drpy2.min.js
vendored
2
JN/dr_py/libs/drpy2.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user