This commit is contained in:
2020-01-02 10:24:33 +08:00
parent 77061d8417
commit c5207b7758
5 changed files with 46 additions and 46 deletions

View File

@@ -1,18 +1,20 @@
let fs = require("fs")
let getreptilelist =(dirlist)=>{
new Promise((res,err)=>{
console.log(dirlist)
return new Promise((res,err)=>{
let reptilelist = [];
// console.log(dirlist)
for(let i in dirlist){
let reptile = require(__dirname + "/" + dirlist[i] +"/config.js" )
console.log(reptile)
// console.log(reptile)
reptilelist.push(reptile)
}
res(reptilelist)
})
}
getlist =()=>{
new Promise((r,e)=>{
return new Promise((r,e)=>{
fs.readdir(__dirname, (err, res) => {
for (let i in res) {
if (res[i] == "binimport.js") {
@@ -28,7 +30,7 @@ getlist =()=>{
})
}
module.exports = getlist()
module.exports = getlist

View File

@@ -36,7 +36,7 @@ let gethtml = async (name, page) => {
let getlist = async (name) => {
let html;
html = await gethtml(name, 1)
console.log(JSON.stringify(html))
// console.log(JSON.stringify(html))
return html;
}
// getlist("偷星九月天")

View File

@@ -2,12 +2,14 @@ const cheerio = require('cheerio');
const axios = require('axios')
let getscript = async (url) => {
let text;
url = "https://www.gufengmh8.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()
@@ -23,10 +25,13 @@ let getscript = async (url) => {
// prevChapterData 上一页信息
// nextChapterData 下一页信息
// 页面地址为 基础url + 页信息.id
console.log({ imghost, chapterPath, chapterImages, pageTitle, pageUrl, prevChapterData, nextChapterData, pageImage })
return { imghost, chapterPath, chapterImages, pageTitle, pageUrl, prevChapterData, nextChapterData, pageImage }
// console.log({ imghost, chapterPath, chapterImages, pageTitle, pageUrl, prevChapterData, nextChapterData, pageImage })
list = { imghost, chapterPath, chapterImages, pageTitle, pageUrl, prevChapterData, nextChapterData, pageImage }
// console.log(list)
}
})
return list;
}
// getscript('')