32 lines
1.2 KiB
JavaScript
32 lines
1.2 KiB
JavaScript
const cheerio = require('cheerio');
|
|
const axios = require('axios')
|
|
let getscript = async (url) => {
|
|
let text;
|
|
await axios.get('https://www.gufengmh8.com/manhua/touxingjiuyuetian/1152122.html').then((res)=>{
|
|
// text = res.text
|
|
// console.log(res.data)
|
|
text = res.data
|
|
})
|
|
let $ = cheerio.load(text);
|
|
$('script').each((index, ele) => {
|
|
// console.log(ele)
|
|
let text = $(ele).html()
|
|
if (text.search('chapterImages') != -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 })
|
|
return { imghost, chapterPath, chapterImages, pageTitle, pageUrl, prevChapterData, nextChapterData, pageImage }
|
|
}
|
|
})
|
|
}
|
|
|
|
getscript('') |