修复了扑飞
This commit is contained in:
parent
d80c21fcd8
commit
19ecee362a
@ -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) => {
|
||||
|
||||
|
@ -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]
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user