diff --git a/bin/reptile/pufei_net/find.js b/bin/reptile/pufei_net/find.js index c6c55a5..35a4000 100644 --- a/bin/reptile/pufei_net/find.js +++ b/bin/reptile/pufei_net/find.js @@ -1,10 +1,10 @@ const puppeteer = require('puppeteer'); const cheerio = require('cheerio') -let mainurl = "http://www.alimanhua.com/" +let mainurl = "http://www.pufei8.com" let gethtml = (name) => { return new Promise(async (res, rej) => { puppeteer.launch({ - headless: false, + headless: true, args: ['--no-sandbox', '--disable-setuid-sandbox','--blink-settings=imagesEnabled=false'] }).then(async (browser) => { diff --git a/bin/reptile/pufei_net/picture.js b/bin/reptile/pufei_net/picture.js index 92250f2..6c18b32 100644 --- a/bin/reptile/pufei_net/picture.js +++ b/bin/reptile/pufei_net/picture.js @@ -1,18 +1,23 @@ const cheerio = require('cheerio'); const axios = require('axios') const iconv = require("iconv-lite") -let mainurl = "http://www.alimanhua.com" +let mainurl = "http://www.pufei8.com" let getscript = async (url) => { let text; let imglist = [] // 图片列表 let scrurl = "" //图片域名 let baseurl = "" //图片基本url url = mainurl + url - await axios({url,responseType: 'arraybuffer'}).then((res)=>{ + // console.log(url) + await axios({url,responseType: 'arraybuffer',headers:{ + 'User-Agent': `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36` + }}).then((res)=>{ // text = res.text text = iconv.decode(res.data, 'gbk'); // console.log(text) // text = res.data + },(err)=>{ + // console.log(err) }) let $ = cheerio.load(text); $('script').each((index, ele) => { @@ -45,6 +50,8 @@ let getscript = async (url) => { // console.log(imgserver) scrurl = imgserver // text = res.data + },(err)=>{ + // console.log(err) }) for(let i in imglist){ imglist[i] = "/" + imglist[i] diff --git a/controllers/main.js b/controllers/main.js index f88d13c..2dffbf4 100644 --- a/controllers/main.js +++ b/controllers/main.js @@ -60,6 +60,7 @@ let findlist = async (ctx, next) => { let section = async (ctx, next) => { for (let i in reptilelist) { if (ctx.query.name == reptilelist[i].name) { + console.log(reptilelist[i].name) ctx.body = await reptilelist[i].section(ctx.query.url) } }