|
|
|
@ -1,78 +1,78 @@ |
|
|
|
|
//本代码仅用于个人学习,请勿用于其他作用,下载后请24小时内删除,代码虽然是公开学习的,但请尊重作者,应留下说明
|
|
|
|
|
function autoerji(url,html){ |
|
|
|
|
function autoerji(url, html) { |
|
|
|
|
let data = {}; |
|
|
|
|
if(!/http/.test(url)){return data;} |
|
|
|
|
let html = html||request(url, {headers: {'User-Agent': PC_UA }, timeout: 5000}); |
|
|
|
|
if (!/http/.test(url)) { return data; } |
|
|
|
|
let html = html || request(url, { headers: { 'User-Agent': PC_UA }, timeout: 5000 }); |
|
|
|
|
let urldomian = getHome(url); |
|
|
|
|
log(urldomian); |
|
|
|
|
|
|
|
|
|
let urltmpl = JSON.parse(getMyVar('Tmpl-'+urldomian,'{}')); |
|
|
|
|
let tmplidex = erjiTmpl.findIndex(it=>it.id===urltmpl.id); |
|
|
|
|
if(tmplidex>-1) { |
|
|
|
|
let urltmpl = JSON.parse(getMyVar('Tmpl-' + urldomian, '{}')); |
|
|
|
|
let tmplidex = erjiTmpl.findIndex(it => it.id === urltmpl.id); |
|
|
|
|
if (tmplidex > -1) { |
|
|
|
|
let tmpl = erjiTmpl.splice(tmplidex, 1)[0]; |
|
|
|
|
erjiTmpl.unshift(tmpl); |
|
|
|
|
} |
|
|
|
|
let detail = {}; |
|
|
|
|
//线程
|
|
|
|
|
let task = function(obj) { |
|
|
|
|
let task = function (obj) { |
|
|
|
|
//log('【'+obj.id+'】');
|
|
|
|
|
let arts = _pdfa(html, obj.tabs); |
|
|
|
|
let tabs = []; |
|
|
|
|
arts.forEach(item => { |
|
|
|
|
let name = pdfh(item, obj.tab_text?obj.tab_text:'h3||a||span||body&&Text'); |
|
|
|
|
if(name&&!/更多精品/.test(name)){ |
|
|
|
|
let name = pdfh(item, obj.tab_text ? obj.tab_text : 'h3||a||span||body&&Text'); |
|
|
|
|
if (name && !/更多精品/.test(name)) { |
|
|
|
|
tabs.push(name); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
let conts = _pdfa(html,'body&&'+obj.lists.split(';')[0]);//全线路影片列表
|
|
|
|
|
let conts = _pdfa(html, 'body&&' + obj.lists.split(';')[0]);//全线路影片列表
|
|
|
|
|
let lists = []; |
|
|
|
|
let key = obj.lists.split(';')[1]; |
|
|
|
|
conts.forEach(item=>{ |
|
|
|
|
conts.forEach(item => { |
|
|
|
|
let cont = _pdfa(item, key);//单线路影片列表
|
|
|
|
|
let list = []; |
|
|
|
|
for (let j = 0; j < cont.length; j++) { |
|
|
|
|
let listname = _pdfh(cont[j],"a&&Text"); |
|
|
|
|
let listurl = _pd(cont[j], obj.tab_id||'a&&href', urldomian); |
|
|
|
|
if(listname&&listurl){ |
|
|
|
|
list.push(listname+"$"+listurl); |
|
|
|
|
let listname = _pdfh(cont[j], "a&&Text"); |
|
|
|
|
let listurl = _pd(cont[j], obj.tab_id || 'a&&href', urldomian); |
|
|
|
|
if (listname && listurl) { |
|
|
|
|
list.push(listname + "$" + listurl); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(list.length>0){ |
|
|
|
|
if (list.length > 0) { |
|
|
|
|
lists.push(list); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
let details1,pic,desc; |
|
|
|
|
try{ |
|
|
|
|
let details1, pic, desc; |
|
|
|
|
try { |
|
|
|
|
let details = obj.desc.split(';'); |
|
|
|
|
details1 = ""; |
|
|
|
|
for(let j=0;j<details.length;j++){ |
|
|
|
|
for (let j = 0; j < details.length; j++) { |
|
|
|
|
details1 = details1.concat(_pdfh(html, details[j])); |
|
|
|
|
} |
|
|
|
|
if(details1&&!detail.details1){detail.details1 = details1;} |
|
|
|
|
}catch(e){} |
|
|
|
|
if (details1 && !detail.details1) { detail.details1 = details1; } |
|
|
|
|
} catch (e) { } |
|
|
|
|
|
|
|
|
|
try{ |
|
|
|
|
pic = _pdfh(html, obj.img).replace(/http.*\/tu\.php\?tu=|\/img\.php\?url=| |\/tu\.php\?tu=/g,''); |
|
|
|
|
if(!/^http/.test(pic)&&pic){ |
|
|
|
|
try { |
|
|
|
|
pic = _pdfh(html, obj.img).replace(/http.*\/tu\.php\?tu=|\/img\.php\?url=| |\/tu\.php\?tu=/g, ''); |
|
|
|
|
if (!/^http/.test(pic) && pic) { |
|
|
|
|
pic = urldomian + pic; |
|
|
|
|
} |
|
|
|
|
if(pic&&!detail.pic){detail.pic = pic;} |
|
|
|
|
}catch(e){} |
|
|
|
|
try{ |
|
|
|
|
desc = obj.content?_pdfh(html,obj.content):""; |
|
|
|
|
if(desc&&!detail.desc){detail.desc = desc;} |
|
|
|
|
}catch(e){} |
|
|
|
|
if(obj.id==35){ |
|
|
|
|
if (pic && !detail.pic) { detail.pic = pic; } |
|
|
|
|
} catch (e) { } |
|
|
|
|
try { |
|
|
|
|
desc = obj.content ? _pdfh(html, obj.content) : ""; |
|
|
|
|
if (desc && !detail.desc) { detail.desc = desc; } |
|
|
|
|
} catch (e) { } |
|
|
|
|
if (obj.id == 35) { |
|
|
|
|
log(obj.id); |
|
|
|
|
log(tabs); |
|
|
|
|
log(lists); |
|
|
|
|
} |
|
|
|
|
return {details1:details1,pic:pic,desc:desc,tabs:tabs,lists:lists}; |
|
|
|
|
return { details1: details1, pic: pic, desc: desc, tabs: tabs, lists: lists }; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
let setid = 0; |
|
|
|
|
let Tmpls = erjiTmpl.map((item)=>{ |
|
|
|
|
let Tmpls = erjiTmpl.map((item) => { |
|
|
|
|
return { |
|
|
|
|
func: task, |
|
|
|
|
param: item, |
|
|
|
@ -81,8 +81,8 @@ function autoerji(url,html){ |
|
|
|
|
}); |
|
|
|
|
let t = {}; |
|
|
|
|
be(Tmpls, { |
|
|
|
|
func: function(obj, id, error, taskResult) { |
|
|
|
|
if (taskResult.tabs.length>0&&taskResult.lists.length>0) { |
|
|
|
|
func: function (obj, id, error, taskResult) { |
|
|
|
|
if (taskResult.tabs.length > 0 && taskResult.lists.length > 0) { |
|
|
|
|
setid = id; |
|
|
|
|
data = taskResult; |
|
|
|
|
o = obj; |
|
|
|
@ -93,32 +93,32 @@ function autoerji(url,html){ |
|
|
|
|
o: t, |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
if(setid>0&&data.tabs.length>0&&data.lists.length>0){ |
|
|
|
|
putMyVar('Tmpl-'+urldomian, JSON.stringify(t)); |
|
|
|
|
if(data.tabs.length>data.lists.length){ |
|
|
|
|
data.tabs.splice(data.lists.length-1, data.tabs.length-data.lists.length); |
|
|
|
|
if (setid > 0 && data.tabs.length > 0 && data.lists.length > 0) { |
|
|
|
|
putMyVar('Tmpl-' + urldomian, JSON.stringify(t)); |
|
|
|
|
if (data.tabs.length > data.lists.length) { |
|
|
|
|
data.tabs.splice(data.lists.length - 1, data.tabs.length - data.lists.length); |
|
|
|
|
} |
|
|
|
|
data.details2 = "数据来源:模板匹配"; |
|
|
|
|
data.details1 = data.details1||detail.details1||""; |
|
|
|
|
data.pic = data.pic||detail.pic||""; |
|
|
|
|
data.desc = data.desc||detail.desc||""; |
|
|
|
|
}else{ |
|
|
|
|
data.details1 = data.details1 || detail.details1 || ""; |
|
|
|
|
data.pic = data.pic || detail.pic || ""; |
|
|
|
|
data.desc = data.desc || detail.desc || ""; |
|
|
|
|
} else { |
|
|
|
|
data = {}; |
|
|
|
|
} |
|
|
|
|
if(data.lists){ |
|
|
|
|
if (data.lists) { |
|
|
|
|
return data; |
|
|
|
|
}else{ |
|
|
|
|
return aierji(html,url,detail); |
|
|
|
|
} else { |
|
|
|
|
return aierji(html, url, detail); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//AI二级
|
|
|
|
|
function aierji(html,url,detail){ |
|
|
|
|
function aierji(html, url, detail) { |
|
|
|
|
var d = []; |
|
|
|
|
let alist = pdfa(html, "body&&a"); |
|
|
|
|
let arr = alist.map(it => { |
|
|
|
|
return { |
|
|
|
|
//html: it,
|
|
|
|
|
text: pdfh(it, "a&&Text").replace(/new|最新|新/g,''), |
|
|
|
|
text: pdfh(it, "a&&Text").replace(/new|最新|新/g, ''), |
|
|
|
|
title: pdfh(it, "a&&title"), |
|
|
|
|
href: pd(it, "a&&href", url) |
|
|
|
|
} |
|
|
|
@ -209,7 +209,7 @@ function aierji(html,url,detail){ |
|
|
|
|
for (let i = 0; i < arr.length; i++) { |
|
|
|
|
let it = arr[i]; |
|
|
|
|
let t = it.text; |
|
|
|
|
if (!it.href || /voddetail|s\/guoyu|vodshow|#playlist/.test(it.href) || (it.href.split('/').length<5)) { |
|
|
|
|
if (!it.href || /voddetail|s\/guoyu|vodshow|#playlist/.test(it.href) || (it.href.split('/').length < 5)) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
let pre = i == 0 ? null : arr[i - 1]; |
|
|
|
@ -228,7 +228,7 @@ function aierji(html,url,detail){ |
|
|
|
|
let lists = []; |
|
|
|
|
let d2 = []; |
|
|
|
|
for (let i = 0; i < d.length; i++) { |
|
|
|
|
d2.push(d[i].title+'$'+d[i].url); |
|
|
|
|
d2.push(d[i].title + '$' + d[i].url); |
|
|
|
|
if (i < d.length - 1) { |
|
|
|
|
let it = d[i]; |
|
|
|
|
let t1 = parseInt(clearText(it.title)); |
|
|
|
@ -236,16 +236,16 @@ function aierji(html,url,detail){ |
|
|
|
|
let t2 = parseInt(clearText(next.title)); |
|
|
|
|
if (t2 - t1 > 1 || t1 - t2 > 1) { |
|
|
|
|
lists.push(d2); |
|
|
|
|
let s = tabs.length+1; |
|
|
|
|
tabs.push("线路"+s); |
|
|
|
|
let s = tabs.length + 1; |
|
|
|
|
tabs.push("线路" + s); |
|
|
|
|
d2 = []; |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
lists.push(d2); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(lists.length==0){tabs = [];} |
|
|
|
|
return {details2: "数据来源:AI识片",details1:detail.details1||"",pic:detail.pic,desc:detail.desc,tabs:tabs,lists:lists}; |
|
|
|
|
if (lists.length == 0) { tabs = []; } |
|
|
|
|
return { details2: "数据来源:AI识片", details1: detail.details1 || "", pic: detail.pic, desc: detail.desc, tabs: tabs, lists: lists }; |
|
|
|
|
} |
|
|
|
|
return {}; |
|
|
|
|
} |
|
|
|
|