fix: 漫小肆 host 变更 (#5973)

Co-authored-by: junfeng <junfeng_pan96@qq.com>
This commit is contained in:
junfengP 2020-10-23 23:33:39 +08:00 committed by GitHub
parent 6083f0f250
commit 0d2cc88e2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -2293,7 +2293,7 @@
},
],
},
'pknbc.com': {
'jjmhw.cc': {
_name: '漫小肆',
www: [
{

View File

@ -1,6 +1,7 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const host = 'http://www.pknbc.com';
const host = 'http://www.jjmhw.cc';
const ua = 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Mobile Safari/537.36';
module.exports = async (ctx) => {
const id = ctx.params.id;
@ -18,9 +19,14 @@ module.exports = async (ctx) => {
link: itemLink,
};
const details = await ctx.cache.tryGet(itemLink, async () => {
const response = await got.get(itemLink);
// 具体页面限制手机UA
const response = await got.get(itemLink, {
headers: {
'user-agent': ua,
},
});
const $ = cheerio.load(response.body);
const imgs = $('div.comicpage img');
const imgs = $('div#cp_img img');
let pics = '';
imgs.each((_, ele) => {
const $ele = $(ele);