提交 946ac958 编写于 作者: H hjdhnx

修复drpy二级重定代码的兼容性(小强迷已正常)

上级 dc85ec77
无法预览此类型文件
3.9.7beta4
\ No newline at end of file
3.9.7beta5
\ No newline at end of file
muban.首图2.二级.content = '.stui-content__desc&&Text';
muban.首图2.二级.title = '.stui-content__detail&&h3&&Text;.stui-content__detail&&p:eq(1)&&Text;';
muban.首图2.二级.重定向='js:let url = jsp.pd(html,".playbtn&&a&&href");log(url);html = request(url)';
muban.首图2.二级.重定向='js:let url = jsp.pd(html,".playbtn&&a&&href");log("重定向到:"+url);html = request(url)';
muban.首图2.二级.tabs='.t-ul&&li';
muban.首图2.二级.lists='.stui-content__playlist:eq(#id)&&li';
......
......@@ -440,7 +440,15 @@ const defaultParser = {
* @returns {string|*}
*/
function pdfh2(html,parse){
let result = defaultParser.pdfh(html,parse);
let html2 = html;
try {
if(typeof(html)!=='string'){
html2 = html.rr(html.ele).toString();
}
}catch (e) {
print('html对象转文本发生了错误:'+e.message);
}
let result = defaultParser.pdfh(html2,parse);
let option = parse.includes('&&')?parse.split('&&').slice(-1)[0]:parse.split(' ').slice(-1)[0];
if(/style/.test(option.toLowerCase())&&/url\(/.test(result)){
try {
......@@ -450,6 +458,24 @@ function pdfh2(html,parse){
return result
}
/**
* pdfa原版优化,可以转换jq的html对象
* @param html
* @param parse
* @returns {*}
*/
function pdfa2(html,parse){
let html2 = html;
try {
if(typeof(html)!=='string'){
html2 = html.rr(html.ele).toString();
}
}catch (e) {
print('html对象转文本发生了错误:'+e.message);
}
return defaultParser.pdfa(html2,parse);
}
/**
* pd原版方法重写-增加自动urljoin
* @param html
......@@ -477,7 +503,7 @@ function pd2(html,parse,uri){
const parseTags = {
jsp:{
pdfh:pdfh2,
pdfa:defaultParser.pdfa,
pdfa:pdfa2,
pd:pd2,
},
json:{
......@@ -1456,6 +1482,7 @@ function detailParse(detailObj){
let vod_play_from = '$$$';
let playFrom = [];
if(p.重定向&&p.重定向.startsWith('js:')){
print('开始执行重定向代码:'+p.重定向);
html = eval(p.重定向.replace('js:',''));
if (_impJQP) {
let c$ = cheerio.load(html);
......@@ -1471,7 +1498,7 @@ function detailParse(detailObj){
console.log(vHeader.length);
for(let v of vHeader){
let v_title = _pdfh(v,'body&&Text');
let v_title = _pdfh(v,'body&&Text').trim();
console.log(v_title);
if(tab_exclude&& (new RegExp(tab_exclude)).test(v_title)){
continue;
......@@ -1510,7 +1537,7 @@ function detailParse(detailObj){
// 请注意,这里要固定pdfh解析body&&Text,不需要下划线,没写错
// new_vod_list.push(pdfh(it,'body&&Text')+'$'+_pd(it,'a&&href',MY_URL));
// new_vod_list.push(cheerio.load(it).text()+'$'+_pd(it,'a&&href',MY_URL));
new_vod_list.push(_pdfh(it, 'body&&Text') + '$' + _pd(it, 'a&&href', MY_URL));
new_vod_list.push(_pdfh(it, 'body&&Text').trim() + '$' + _pd(it, 'a&&href', MY_URL));
});
let vlist = new_vod_list.join('#');
vod_tab_list.push(vlist);
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册