Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 风之动漫域名更换 #60

Merged
merged 1 commit into from
Jul 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions lib/routes/fzdm/manhua.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
const got = require('@/utils/got');
const host = 'https://manhua.fzdm.com';
const domain = 'manhua.fffdm.com';
const host = `https://${domain}`;
const picHost = 'https://p5.fzacg.com';
const cheerio = require('cheerio');

const get_pic = (id, chapert, caches) => {
const picUrlPattern = RegExp(/var (mhurl1|mhurl)="(.*?)";/);
const picUrlPattern = RegExp(/var mhurl = "(.*?)";/);
return caches.tryGet(`${host}/${id}/${chapert}/`, async () => {
let is_last_page = false;
let index = 0;
Expand All @@ -13,15 +15,15 @@ const get_pic = (id, chapert, caches) => {
const response = await got.get(`${host}/${id}/${chapert}/index_${index}.html`, {
headers: {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36',
Host: 'manhua.fzdm.com',
Host: domain,
'Accept-Encoding': 'gzip, deflate, br',
Connection: 'keep-alive',
},
});
const data = response.data;
if (response.data !== undefined) {
const picurl = data.match(picUrlPattern);
pic_content += `<img src='http://www-mipengine-org.mipcdn.com/i/p5.manhuapan.com/${picurl[picurl.length - 1]}'/><br/>`;
pic_content += `<img src='${picHost}/${picurl[picurl.length - 1]}'/><br/>`;
if (data.match('最后一页了') !== null) {
is_last_page = true;
}
Expand Down