添加一个新的源 漫画DB

This commit is contained in:
pplok 2020-01-18 16:58:13 +08:00
parent 5f8af97abe
commit 9fed2b99c1
5 changed files with 174 additions and 0 deletions

View File

@ -0,0 +1,4 @@
古风漫画网
www.gufengmh8.com
find.js 查找功能
section.js 获取章节列表

View File

@ -0,0 +1,17 @@
// import find from "./find"
// import imglist from "./picture"
// import section from "./section"
find = require("./find")
imglist = require("./picture")
section = require("./section")
let name = "漫画DB"
let version = "20.01.18"
let type = 1
module.exports = {
name,
version,
type,
find,
imglist,
section
}

View File

@ -0,0 +1,62 @@
let axios = require('axios')
const cheerio = require('cheerio');
const qs = require('querystring');
let getcontlist = async (text) => {
let $ = cheerio.load(text)
let list = []
// console.log($(".row .m-0").eq(1).html())
$ = cheerio.load($(".row .m-0").eq(1).html())
// console.log($("li").eq(0).html())
$("div").each((index,ele)=>{
let j = cheerio.load($(ele).html(),{decodeEntities: false})
// console.log(unescape(j('.tt').eq(0).html()))
let obj = {};
obj.update = "暂无数据"
obj.name = j(".comicbook-index a").eq(0).attr('title')
obj.date = "暂无数据"
obj.url = j(".comicbook-index a").eq(0).attr('href')
// console.log(obj)
list.push(obj)
})
return list
}
let gethtml = async (name, page) => {
name = qs.escape(name)
let url = `https://www.manhuadb.com/search?q=${name}&p=${page}`
// console.log(url)
let text = ""
await axios.get(url).then((a) => {
// console.log(a.data)
// res(a.text)
text = a.data
})
let list = []
try {
list = await getcontlist(text)
} catch (error) {
// console.log(error)
}
list = {name:"漫画DB",list}
return list
}
let getlist = (name) => {
return new Promise(async (res,rej)=>{
try {
let html;
html = await gethtml(name, 1)
console.log(JSON.stringify(html))
res(html);
} catch (error) {
rej([])
}
})
}
getlist("青春")
module.exports = getlist

View File

@ -0,0 +1,49 @@
const cheerio = require('cheerio');
const axios = require('axios')
let getscript = async (url) => {
let text;
url = "https://www.manhuadb.com" + url
await axios.get(url).then((res)=>{
// text = res.text
// console.log(res.data)
text = res.data
})
let $ = cheerio.load(text);
let list;
$('script').each((index, ele) => {
// console.log(ele)
let text = $(ele).html()
if (text.search('var img_data =') != -1) {
eval(text)
let chapterImages = Buffer.from(img_data, 'base64').toString()
chapterImages = JSON.parse(chapterImages)
let list = []
for(let i in chapterImages){
list.push(chapterImages[i].img)
}
chapterImages = list
// var reg = /^http(s)?:\/\/(.*?)\//
// imghost = reg.exec(pageImage)[2]
let imghost = $(".vg-r-data").eq(0).attr("data-host")
let chapterPath = $(".vg-r-data").eq(0).attr("data-img_pre")
// 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}
console.log(list)
}
})
return list;
}
getscript('/manhua/9008/11109_148948.html')
module.exports = getscript

View File

@ -0,0 +1,42 @@
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())
$(".fade").each((index,ele)=>{
// $(ele)
// console.log($(ele).html())
let obj = {}
let j = cheerio.load($(ele).html(),{decodeEntities: false})
obj.title = j(".comic_version_title").eq(0).html()
// console.log(obj.title)
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)
})
// console.log(JSON.stringify(list))
return list
}
let gethtml = async (url)=>{
let text;
let baseurl = "https://www.manhuadb.com"
await axios.get(baseurl + url).then((res)=>{
text = res.data
})
// console.log(text)
let list = await getsection(text)
// console.log(JSON.stringify(list))
return list
}
// gethtml('/manhua/9008')
module.exports = gethtml