添加验证
This commit is contained in:
parent
878337a2f2
commit
716090b6ef
@ -52,10 +52,14 @@ let gethtml = async (name) => {
|
|||||||
|
|
||||||
let getlist = (name) => {
|
let getlist = (name) => {
|
||||||
return new Promise(async (res,rej)=>{
|
return new Promise(async (res,rej)=>{
|
||||||
let html;
|
try {
|
||||||
html = await gethtml(name)
|
let html;
|
||||||
// console.log(JSON.stringify(html))
|
html = await gethtml(name)
|
||||||
res(html);
|
// console.log(JSON.stringify(html))
|
||||||
|
res(html);
|
||||||
|
} catch (error) {
|
||||||
|
rej([])
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -45,10 +45,15 @@ let gethtml = async (name, page) => {
|
|||||||
|
|
||||||
let getlist = (name) => {
|
let getlist = (name) => {
|
||||||
return new Promise(async (res,rej)=>{
|
return new Promise(async (res,rej)=>{
|
||||||
let html;
|
try {
|
||||||
html = await gethtml(name, 1)
|
let html;
|
||||||
// console.log(JSON.stringify(html))
|
html = await gethtml(name, 1)
|
||||||
res(html);
|
// console.log(JSON.stringify(html))
|
||||||
|
res(html);
|
||||||
|
} catch (error) {
|
||||||
|
rej([])
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,7 @@ let gethtml = (name) => {
|
|||||||
|
|
||||||
let get = (name) => {
|
let get = (name) => {
|
||||||
return new Promise(async (res, rej) => {
|
return new Promise(async (res, rej) => {
|
||||||
|
try {
|
||||||
let html;
|
let html;
|
||||||
await gethtml(name).then((res) => {
|
await gethtml(name).then((res) => {
|
||||||
html = res
|
html = res
|
||||||
@ -115,6 +116,10 @@ let get = (name) => {
|
|||||||
list = { name: "扑飞漫画", list }
|
list = { name: "扑飞漫画", list }
|
||||||
|
|
||||||
res(list);
|
res(list);
|
||||||
|
} catch (error) {
|
||||||
|
rej([])
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -74,38 +74,43 @@ let gethtml = (name) => {
|
|||||||
|
|
||||||
let get = (name) => {
|
let get = (name) => {
|
||||||
return new Promise(async (res,rej)=>{
|
return new Promise(async (res,rej)=>{
|
||||||
let html;
|
|
||||||
await gethtml(name).then((res) => {
|
try {
|
||||||
html = res
|
let html;
|
||||||
})
|
await gethtml(name).then((res) => {
|
||||||
// console.log(html)
|
html = res
|
||||||
let $ = cheerio.load(html)
|
})
|
||||||
let list = []
|
// console.log(html)
|
||||||
await $("#dmList ul li").each((index, ele) => {
|
let $ = cheerio.load(html)
|
||||||
let item = cheerio.load($(ele).html(), { decodeEntities: false })
|
let list = []
|
||||||
let name = item("dl dt a").html()
|
await $("#dmList ul li").each((index, ele) => {
|
||||||
let date = item("dl dd p").eq(0).html()
|
let item = cheerio.load($(ele).html(), { decodeEntities: false })
|
||||||
let url = mainurl + item("dl dt a").attr("href")
|
let name = item("dl dt a").html()
|
||||||
let update = item("dl dd p").eq(1).html().replace("<em>", "").replace('</em><span class="red">', "").replace('</span></p>', "").replace("</span>", "")
|
let date = item("dl dd p").eq(0).html()
|
||||||
date = date.replace("<em>", "").replace('</em><span class="red">', "").replace('</span></p>', "").replace("</span>", "")
|
let url = mainurl + item("dl dt a").attr("href")
|
||||||
// console.log({
|
let update = item("dl dd p").eq(1).html().replace("<em>", "").replace('</em><span class="red">', "").replace('</span></p>', "").replace("</span>", "")
|
||||||
// date,
|
date = date.replace("<em>", "").replace('</em><span class="red">', "").replace('</span></p>', "").replace("</span>", "")
|
||||||
// name,
|
// console.log({
|
||||||
// url,
|
// date,
|
||||||
// update
|
// name,
|
||||||
// })
|
// url,
|
||||||
let l = {
|
// update
|
||||||
date,
|
// })
|
||||||
name,
|
let l = {
|
||||||
url,
|
date,
|
||||||
update
|
name,
|
||||||
}
|
url,
|
||||||
list.push(l)
|
update
|
||||||
})
|
}
|
||||||
// console.log(list)
|
list.push(l)
|
||||||
list = {name:"塔多漫画",list}
|
})
|
||||||
|
// console.log(list)
|
||||||
res(list);
|
list = {name:"塔多漫画",list}
|
||||||
|
|
||||||
|
res(list);
|
||||||
|
} catch (error) {
|
||||||
|
rej([])
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -28,25 +28,28 @@ let findlist = async (ctx, next) => {
|
|||||||
pro.push(reptilelist[i].find(ctx.query.name))
|
pro.push(reptilelist[i].find(ctx.query.name))
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all(pro).then((res) => {
|
await Promise.allSettled(pro).then((res) => {
|
||||||
// console.log(res)
|
// console.log(res)
|
||||||
for (let i in res) {
|
for (let i in res) {
|
||||||
for (let j in res[i].list) {
|
if(i.status == "fulfilled"){
|
||||||
let has = true
|
for (let j in res[i].value.list) {
|
||||||
for (let k in list) {
|
let has = true
|
||||||
if (list[k].name == res[i].list[j].name) {
|
for (let k in list) {
|
||||||
if (list[k].list == undefined) {
|
if (list[k].name == res[i].value.list[j].name) {
|
||||||
list[k].list = []
|
if (list[k].list == undefined) {
|
||||||
|
list[k].list = []
|
||||||
|
}
|
||||||
|
has = false
|
||||||
|
list[k].list.push({ name: res[i].value.name, url: res[i].value.list[j].url, date: res[i].value.list[j].date, update: res[i].value.list[j].update })
|
||||||
}
|
}
|
||||||
has = false
|
|
||||||
list[k].list.push({ name: res[i].name, url: res[i].list[j].url, date: res[i].list[j].date, update: res[i].list[j].update })
|
}
|
||||||
|
if (has) {
|
||||||
|
list.push({ name: res[i].value.list[j].name, list: [{ name: res[i].value.name, url: res[i].value.list[j].url, date: res[i].value.list[j].date, update: res[i].value.list[j].update }] })
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
if (has) {
|
|
||||||
list.push({ name: res[i].list[j].name, list: [{ name: res[i].name, url: res[i].list[j].url, date: res[i].list[j].date, update: res[i].list[j].update }] })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user