新增土豪漫画源

This commit is contained in:
luyuan 2020-02-28 11:35:22 +08:00
parent 19b34fb5a4
commit 9af90677b5
4 changed files with 193 additions and 0 deletions

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 = "土豪漫画"
let version = "20.02.28"
let type = 1
module.exports = {
name,
version,
type,
find,
imglist,
section
}

View File

@ -0,0 +1,61 @@
let axios = require('axios')
const cheerio = require('cheerio');
const qs = require('querystring');
let getcontlist = async (text) => {
let $ = cheerio.load(text)
let list = []
$ = cheerio.load($(".mh-list.col7").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('.chapter').eq(0).text()
obj.name = j(".title a").eq(0).attr('title')
obj.date = '未获取'
obj.url = 'https://www.tohomh123.com' + j(".title 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.tohomh123.com/action/Search?keyword=${name}`
// console.log(url)
let text = ""
await axios.get(url).then((a) => {
// console.log(a.text)
// res(a.text)
text = a.data
})
let list = []
try {
list = await getcontlist(text)
} catch (error) {
// console.log(error)
}
list = {name:"土豪漫画",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,74 @@
const cheerio = require('cheerio');
const axios = require('axios')
const iconv = require("iconv-lite")
let mainurl = "https://www.tohomh123.com"
let getscript = async (url) => {
let text;
let imglist = [] // 图片列表
let scrurl = "" //图片域名
let baseurl = "" //图片基本url
url = mainurl + url
// console.log(url)
await axios({url}).then((res)=>{
// text = res.text
// text = iconv.decode(res.data, 'gbk');
// console.log(res.data)
text = res.data
})
// return ;
let $ = cheerio.load(text);
let info;
$('script').each((index, ele) => {
// console.log(ele)
let text = $(ele).html()
let href = $(ele).attr("src")
if (text.search('did') != -1) {
eval(text)
info = {did,sid,pcount}
// console.log(ret_classurl)
// imglist = photosr
// baseurl = ret_classurl
}
// if(href && href.search('global.js') != -1){
// // console.log(href)
// scrurl = href
// }
})
// console.log(info)
// return ;
// 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
// })
for(let i = 1;i <= info.pcount; i++){
// imglist.push
await axios({url:"https://www.tohomh123.com/action/play/read",data:{...info,iid:i}}).then((res)=>{
imglist.push(res.data.Code)
})
}
// console.log(imglist)
return{
imghost: "",
chapterPath:"",
chapterImages:imglist
}
// return list;
}
// getscript('/douluodaliu/230.html').then((res)=>{
// console.log(res)
// })
module.exports = getscript

View File

@ -0,0 +1,41 @@
let axios = require('axios')
const cheerio = require('cheerio');
let iconv = require('iconv-lite');
let getsection = async (text) => {
// var text = iconv.decode(text, 'gbk');
let $ = cheerio.load(text, { decodeEntities: false })
let list = []
$("#detail-list-select-1 li").each((index, ele) => {
let item = cheerio.load($(ele).html(), { decodeEntities: false })
let url = item("a").attr("href")
let title = item("a").text()
// console.log(title)
list.push({url,title})
})
list = list.reverse()
// console.log(list)
list = [{
title:"列表",
list:list
}]
return list
}
let gethtml = async (url) => {
let text;
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.tohomh123.com/douluodaliu/')
module.exports = gethtml