This commit is contained in:
pplokijuhyg 2020-01-03 14:29:01 +08:00
parent 0ee00e6bec
commit a01152fc8a
10 changed files with 3304 additions and 89 deletions

View File

@ -17,11 +17,11 @@ let idadd = async (set) => {
if (id == 1) {
await add('idadd', { set, 'num_key': 2 })
} else if (set != "idadd") {
console.log(id)
// console.log(id)
await update('idadd', { 'set': set }, { 'num_key': id + 1 })
}
console.log(id)
// console.log(id)
return id
}

View File

@ -30,7 +30,16 @@ let gethtml = async (name, page) => {
// res(a.text)
text = a.data
})
return await getcontlist(text)
let list = []
try {
list = await getcontlist(text)
} catch (error) {
// console.log(error)
}
return list
}
let getlist = async (name) => {

View File

@ -17,6 +17,7 @@ let getscript = async (url) => {
eval(text)
var reg = /^http(s)?:\/\/(.*?)\//
imghost = reg.exec(pageImage)[2]
imghost = "http://" + imghost
// imghost 图片域名
// chapterPath 图片基本链接path
// chapterImages 图片地址数组

View File

@ -1,43 +1,70 @@
let axios = require('axios')
const cheerio = require('cheerio');
const qs = require('querystring');
let getcontlist = async (text) => {
let $ = cheerio.load(text)
let list = []
$ = cheerio.load($("#contList").eq(0).html())
// console.log($("li").eq(0).html())
$("li").each((index,ele)=>{
let j = cheerio.load($(ele).html(),{decodeEntities: false})
// console.log(unescape(j('.tt').eq(0).html()))
let obj = {};
obj.update = j('.tt').eq(0).html()
obj.name = j(".ell a").eq(0).html()
obj.date = j(".updateon").eq(0).html().replace(/\s+/g,"").replace('<em>1.0</em>','')
obj.url = j(".cover").eq(0).attr('href')
// console.log(obj)
list.push(obj)
const puppeteer = require('puppeteer');
const cheerio = require('cheerio')
let mainurl = "http://www.taduo.net/"
let gethtml = (name) => {
return new Promise(async (res, rej) => {
puppeteer.launch({
headless: true,
}).then(async (browser) => {
const page = await browser.newPage();
await page.goto(mainurl);
await page.type(".searchtext1", name);
// const usernameValue = await page.$eval(".searchtext1", el => el.value);
await page.click("#btnSend1")
let openpages = []
setTimeout(async () => {
await browser.pages().then((res) => {
// console.log(res.length)
openpages = res
})
await openpages[2].content().then((r) => {
res(r)
})
// console.log(a)
// await page.content().then((r)=>{
// res(r)
// })
browser.close()
}, 1500);
})
})
return list
}
let gethtml = async (name, page) => {
name = qs.escape(name)
let url = `https://www.gufengmh8.com/search/?keywords=${name}&page=${page}`
// console.log(url)
let text = ""
await axios.get(url).then((a) => {
// console.log(a.text)
// res(a.text)
text = a.data
})
return await getcontlist(text)
}
let getlist = async (name) => {
let get = async (name) => {
let html;
html = await gethtml(name, 1)
// console.log(JSON.stringify(html))
return html;
await gethtml(name).then((res) => {
html = res
})
// console.log(html)
let $ = cheerio.load(html)
let list = []
await $("#dmList ul li").each((index, ele) => {
let item = cheerio.load($(ele).html(), { decodeEntities: false })
let name = item("dl dt a").html()
let date = item("dl dd p").eq(0).html()
let url = mainurl + item("dl dt a").attr("href")
let update = item("dl dd p").eq(1).html().replace("<em>", "").replace('</em><span class="red">', "").replace('</span></p>', "").replace("</span>", "")
date = date.replace("<em>", "").replace('</em><span class="red">', "").replace('</span></p>', "").replace("</span>", "")
// console.log({
// date,
// name,
// url,
// update
// })
let l = {
date,
name,
url,
update
}
list.push(l)
})
// console.log(list)
return list;
}
// getlist("偷星九月天")
module.exports = getlist
module.exports = get

View File

@ -1,40 +1,59 @@
const cheerio = require('cheerio');
const axios = require('axios')
const iconv = require("iconv-lite")
let mainurl = "http://www.taduo.net/"
let getscript = async (url) => {
let text;
url = "https://www.gufengmh8.com" + url
await axios.get(url).then((res)=>{
let imglist = [] // 图片列表
let scrurl = "" //图片域名
let baseurl = "" //图片基本url
url = mainurl + url
await axios({url,responseType: 'arraybuffer'}).then((res)=>{
// text = res.text
// console.log(res.data)
text = res.data
text = iconv.decode(res.data, 'gbk');
// console.log(text)
// text = res.data
})
let $ = cheerio.load(text);
let list;
$('script').each((index, ele) => {
// console.log(ele)
let text = $(ele).html()
if (text.search('chapterImages') != -1) {
let href = $(ele).attr("src")
if (text.search('packed') != -1) {
eval(text)
var reg = /^http(s)?:\/\/(.*?)\//
imghost = reg.exec(pageImage)[2]
// imghost 图片域名
// chapterPath 图片基本链接path
// chapterImages 图片地址数组
// pageTitle 标题
// pageUrl 页面基础url
// prevChapterData 上一页信息
// nextChapterData 下一页信息
// 页面地址为 基础url + 页信息.id
// console.log({ imghost, chapterPath, chapterImages, pageTitle, pageUrl, prevChapterData, nextChapterData, pageImage })
let down = pageUrl.replace("https://www.gufengmh8.com","") + nextChapterData.id + ".html"
let upurl = pageUrl.replace("https://www.gufengmh8.com","") + prevChapterData.id + ".html"
list = { imghost, chapterPath, chapterImages, pageTitle, pageUrl, prevChapterData, nextChapterData, pageImage,down,upurl }
// console.log(list)
// console.log(ret_classurl)
imglist = photosr
baseurl = ret_classurl
}
if(href && href.search('global.js') != -1){
// console.log(href)
scrurl = href
}
})
return list;
await axios({url : mainurl + scrurl,responseType: 'arraybuffer'}).then((res)=>{
// text = res.text
let scr = iconv.decode(res.data, 'gbk');
scr=scr.substring(scr.indexOf("//服务器切换") + 1,scr.indexOf("//屏蔽js错误"))
scr=scr.substring(scr.indexOf("current_img_base = photosr[page];") + 33,scr.indexOf("if (current_img_base.indexOf('http://') != -1 ) {"))
let WebimgServer = []
let WebimgServerURL = []
eval(scr)
// console.log(WebimgServerURL)
scrurl = WebimgServerURL[0]
// text = res.data
})
return{
imghost:scrurl,
chapterPath:baseurl,
chapterImages:imglist
}
// return list;
}
// getscript('')
// getscript('/manhua/984/92761.html').then((res)=>{
// console.log(res)
// })
module.exports = getscript

View File

@ -1,39 +1,37 @@
let axios = require('axios')
const cheerio = require('cheerio');
let getsection = async (text)=>{
let $ = cheerio.load(text)
let list = [];
// console.log($(".comic-chapters ").eq(0).html())
$(".comic-chapters").each((index,ele)=>{
// $(ele)
// console.log($(ele).html())
let obj = {}
let j = cheerio.load($(ele).html(),{decodeEntities: false})
obj.title = j(".pull-left").eq(0).html().replace('<span>','').replace('</span>','')
obj.list = []
j('li').each(function (index,ele){
let con = {}
con.url = j(this).find("a").eq(0).attr('href')
con.title = j(this).find("a").eq(0).html().replace('<span>','').replace('</span>','').replace(/\s+/g,"").replace('\\n','')
obj.list.push(con)
})
// console.log(obj)
list.push(obj)
let iconv = require('iconv-lite');
let getsection = async (text) => {
var text = iconv.decode(text, 'gbk');
let $ = cheerio.load(text, { decodeEntities: false })
let list = []
$("#play_0 ul li").each((index, ele) => {
let item = cheerio.load($(ele).html(), { decodeEntities: false })
let url = item("a").attr("href")
let title = item("a").html()
// console.log(title)
list.push({url,title})
})
list = list.reverse()
// console.log(list)
return list
}
let gethtml = async (url)=>{
let gethtml = async (url) => {
let text;
await axios.get(url).then((res)=>{
text = res.data
})
await axios({url,responseType: 'arraybuffer'}).then((res) => {
text = res.data
})
// console.log(text)
let list = await getsection(text)
// list = [{
// title:"漫画列表",
// list
// }]
// console.log(list)
// console.log(JSON.stringify(list))
return list
}
// gethtml('https://www.gufengmh8.com/manhua/touxingjiuyuetian/')
// gethtml('http://www.taduo.net/manhua/984/')
module.exports = gethtml

View File

@ -3,7 +3,25 @@ let findlist = async (ctx,next)=>{
let list = []
for(let i in reptilelist){
let a = await reptilelist[i].find(ctx.query.name)
list.push({name:reptilelist[i].name,list: [...a]})
// list.push({name:reptilelist[i].name,list: [...a]})
for(let j in a){
let has = true
for(let k in list){
if(list[k].name == a[j].name){
if(list[k].list == undefined){
list[k].list = []
}
has = false
list[k].list.push({name:reptilelist[i].name,url:a[j].url,date:a[j].date,update:a[j].update})
}
}
if(has){
list.push({name:a[j].name,list:[{name:reptilelist[i].name,url:a[j].url,date:a[j].date,update:a[j].update}]})
}
}
}
ctx.body = JSON.stringify(list)
}

View File

@ -12,6 +12,7 @@
"axios": "^0.19.0",
"cheerio": "^1.0.0-rc.3",
"fs": "^0.0.1-security",
"iconv-lite": "^0.5.0",
"koa": "^2.11.0",
"koa-bodyparser": "^4.2.1",
"koa-router": "^7.4.0",

3135
yarn-error.log Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1327,6 +1327,13 @@ iconv-lite@0.4.24:
dependencies:
safer-buffer ">= 2.1.2 < 3"
iconv-lite@^0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.5.0.tgz#59cdde0a2a297cc2aeb0c6445a195ee89f127550"
integrity sha512-NnEhI9hIEKHOzJ4f697DMz9IQEXr/MMJ5w64vN2/4Ai+wRnvV7SBrL0KLoRlwaKVghOc7LQ5YkPLuX146b6Ydw==
dependencies:
safer-buffer ">= 2.1.2 < 3"
indent-string@^2.1.0:
version "2.1.0"
resolved "https://registry.npm.taobao.org/indent-string/download/indent-string-2.1.0.tgz#8e2d48348742121b4a8218b7a137e9a52049dc80"