core/bin/reptile/177mh_net/picture.js
2020-01-13 11:00:58 +08:00

76 lines
2.6 KiB
JavaScript

const cheerio = require('cheerio');
const axios = require('axios')
let getscript = async (url) => {
let text;
url = "https://www.177mh.net" + url
// console.log(url)
await axios.get(url).then((res)=>{
// text = res.text
// console.log(res.data)
text = res.data
})
let $ = cheerio.load(text);
let list;
let chapterImages;
let cid,coid,ser,imgs;
$('script').each((index, ele) => {
// console.log(ele)
let text = $(ele).html()
if (text.search('eval') != -1) {
eval(text)
// imghost
// console.log(msg.split("|"))
chapterImages = msg.split("|")
// console.log(chapterImages)
cid = /\/colist_(\d+)\.html/.exec(link_z)[1];
coid = /\/(\d+\/\d+)\.html/.exec(url);
coid = /\d+\/(\d+)/.exec(coid)[1];
console.log(img_s)
ser = `https://css.gdbyhtl.net/img_v1/cn_svr.aspx?z=gn&s=${img_s}&cid=${cid}&coid=${coid}`
imgs = img_s
// let r = ""
// eval(r)
// let qianzso = img_qianzso[img_s]
// console.log(qianzso)
// var reg = /^http(s)?:\/\/(.*?)\//
// imghost = reg.exec(pageImage)[2]
// imghost = "http://" + imghost
// 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"
// console.log(list)
}
})
let r = "";
console.log(ser)
await axios.get(ser).then((res)=>{
r = res.data
// console.log(res)
})
eval(r)
// console.log(img_qianzso)
let qianzso = img_qianzso[imgs]
console.log(webpshow)
if(webpshow == 1){
chapterImages = chapterImages.map(x => x + ".webp")
}
list = { chapterImages , imghost:qianzso ,chapterPath:"",fanpa:{head:{"Referer": "https://www.177mh.net"}} }
console.log(list)
return list;
}
// getscript('/201008/167494.html')
module.exports = getscript