修复了扑飞
This commit is contained in:
parent
d80c21fcd8
commit
19ecee362a
@ -1,10 +1,10 @@
|
|||||||
const puppeteer = require('puppeteer');
|
const puppeteer = require('puppeteer');
|
||||||
const cheerio = require('cheerio')
|
const cheerio = require('cheerio')
|
||||||
let mainurl = "http://www.alimanhua.com/"
|
let mainurl = "http://www.pufei8.com"
|
||||||
let gethtml = (name) => {
|
let gethtml = (name) => {
|
||||||
return new Promise(async (res, rej) => {
|
return new Promise(async (res, rej) => {
|
||||||
puppeteer.launch({
|
puppeteer.launch({
|
||||||
headless: false,
|
headless: true,
|
||||||
args: ['--no-sandbox', '--disable-setuid-sandbox','--blink-settings=imagesEnabled=false']
|
args: ['--no-sandbox', '--disable-setuid-sandbox','--blink-settings=imagesEnabled=false']
|
||||||
}).then(async (browser) => {
|
}).then(async (browser) => {
|
||||||
|
|
||||||
|
@ -1,18 +1,23 @@
|
|||||||
const cheerio = require('cheerio');
|
const cheerio = require('cheerio');
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
const iconv = require("iconv-lite")
|
const iconv = require("iconv-lite")
|
||||||
let mainurl = "http://www.alimanhua.com"
|
let mainurl = "http://www.pufei8.com"
|
||||||
let getscript = async (url) => {
|
let getscript = async (url) => {
|
||||||
let text;
|
let text;
|
||||||
let imglist = [] // 图片列表
|
let imglist = [] // 图片列表
|
||||||
let scrurl = "" //图片域名
|
let scrurl = "" //图片域名
|
||||||
let baseurl = "" //图片基本url
|
let baseurl = "" //图片基本url
|
||||||
url = mainurl + 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 = res.text
|
||||||
text = iconv.decode(res.data, 'gbk');
|
text = iconv.decode(res.data, 'gbk');
|
||||||
// console.log(text)
|
// console.log(text)
|
||||||
// text = res.data
|
// text = res.data
|
||||||
|
},(err)=>{
|
||||||
|
// console.log(err)
|
||||||
})
|
})
|
||||||
let $ = cheerio.load(text);
|
let $ = cheerio.load(text);
|
||||||
$('script').each((index, ele) => {
|
$('script').each((index, ele) => {
|
||||||
@ -45,6 +50,8 @@ let getscript = async (url) => {
|
|||||||
// console.log(imgserver)
|
// console.log(imgserver)
|
||||||
scrurl = imgserver
|
scrurl = imgserver
|
||||||
// text = res.data
|
// text = res.data
|
||||||
|
},(err)=>{
|
||||||
|
// console.log(err)
|
||||||
})
|
})
|
||||||
for(let i in imglist){
|
for(let i in imglist){
|
||||||
imglist[i] = "/" + imglist[i]
|
imglist[i] = "/" + imglist[i]
|
||||||
|
@ -60,6 +60,7 @@ let findlist = async (ctx, next) => {
|
|||||||
let section = async (ctx, next) => {
|
let section = async (ctx, next) => {
|
||||||
for (let i in reptilelist) {
|
for (let i in reptilelist) {
|
||||||
if (ctx.query.name == reptilelist[i].name) {
|
if (ctx.query.name == reptilelist[i].name) {
|
||||||
|
console.log(reptilelist[i].name)
|
||||||
ctx.body = await reptilelist[i].section(ctx.query.url)
|
ctx.body = await reptilelist[i].section(ctx.query.url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user