mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-21 12:49:53 +08:00
fix(route): 修复风之动漫 (#11873)
* fix(route): 修复风之动漫 * fix(route): 修复风之动漫 * fix(route): 修复风之动漫 * fix(route): 修复风之动漫 * Update lib/v2/fzdm/manhua/manhua.js * Update lib/v2/fzdm/manhua/manhua.js * fix(route): 修复风之动漫 * Update lib/v2/fzdm/radar.js * fix(route): 修复风之动漫 * Update lib/v2/fzdm/manhua/manhua.js * Update lib/v2/fzdm/manhua/manhua.js * Update lib/v2/fzdm/manhua/manhua.js * Update lib/v2/fzdm/manhua/manhua.js * fix: update route path --------- Co-authored-by: zytomorrow <z794672847@gamil.com>
This commit is contained in:
+2
-2
@@ -592,9 +592,9 @@ Sources
|
||||
|
||||
## 风之动漫
|
||||
|
||||
### 风之动漫
|
||||
### 在线漫画
|
||||
|
||||
<Route author="geeeeoff zytomorrow" path="/fzdm/manhua/:id" example="/fzdm/manhua/93" :paramsDesc="['漫画ID。默认获取全部,建议使用通用参数limit获取指定数量']" anticrawler="1"/>
|
||||
<Route author="geeeeoff zytomorrow" path="/fffdm/manhua/:id/:cdn?" example="/fffdm/manhua/93" :paramsDesc="['漫画ID。默认获取全部,建议使用通用参数limit获取指定数量', 'cdn加速器。默认5,当前可选1-5']" radar="1" rssbud="1"/>
|
||||
|
||||
## 海猫吧
|
||||
|
||||
|
||||
+1
-1
@@ -2800,7 +2800,7 @@ router.get('/grubstreet', lazyloadRouteHandler('./routes/grubstreet/index'));
|
||||
router.get('/manhuadui/manhua/:name/:serial?', lazyloadRouteHandler('./routes/manhuadui/manhua'));
|
||||
|
||||
// 风之漫画
|
||||
router.get('/fzdm/manhua/:id', lazyloadRouteHandler('./routes/fzdm/manhua'));
|
||||
// router.get('/fzdm/manhua/:id', lazyloadRouteHandler('./routes/fzdm/manhua'));
|
||||
|
||||
// Aljazeera 半岛网
|
||||
// router.get('/aljazeera/news', lazyloadRouteHandler('./routes/aljazeera/news'));
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
const got = require('@/utils/got');
|
||||
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 mhurl = "(.*?)";/);
|
||||
return caches.tryGet(`${host}/${id}/${chapert}/`, async () => {
|
||||
let is_last_page = false;
|
||||
let index = 0;
|
||||
let pic_content = '';
|
||||
while (!is_last_page) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const response = await got.get(`${host}/${id}/${chapert}/index_${index}.html`);
|
||||
const data = response.data;
|
||||
if (response.data !== undefined) {
|
||||
const picurl = data.match(picUrlPattern);
|
||||
pic_content += `<img src='${picHost}/${picurl[picurl.length - 1]}'/><br/>`;
|
||||
if (data.match('最后一页了') !== null) {
|
||||
is_last_page = true;
|
||||
}
|
||||
} else {
|
||||
pic_content += '';
|
||||
is_last_page = true;
|
||||
}
|
||||
|
||||
index += 1;
|
||||
}
|
||||
return pic_content;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
const count = ctx.query.limit || 99999;
|
||||
const comicPage = host + `/${id}/`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: comicPage,
|
||||
});
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('div#content > li > a').toArray();
|
||||
const comicTitle = $('div#content > img').attr('alt').replace(/漫画/, '');
|
||||
const chapter_detail = await Promise.all(
|
||||
list.splice(0, count).map(async (item) => {
|
||||
const pic_content = await get_pic(id, $(item).attr('href').replace('/', ''), ctx.cache);
|
||||
return {
|
||||
title: $(item).text().trim(),
|
||||
description: pic_content,
|
||||
link: `${comicPage}${item.attribs.href}`,
|
||||
};
|
||||
})
|
||||
);
|
||||
ctx.state.data = {
|
||||
title: '风之动漫 - ' + comicTitle,
|
||||
link: comicPage,
|
||||
description: '风之动漫',
|
||||
item: chapter_detail,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/manhua/:id/:cdn?': ['zytomorrow'],
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
const got = require('@/utils/got');
|
||||
const domain = 'manhua.fffdm.com';
|
||||
const host = `https://${domain}`;
|
||||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
const get_pic = async (url) => {
|
||||
const response = await got(url);
|
||||
const data = response.data;
|
||||
return {
|
||||
comicTitle: data.mhinfo.title,
|
||||
chapterTitle: data.title,
|
||||
pics: data.cont,
|
||||
pubDate: parseDate(data.mh.time),
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
const count = ctx.query.limit || 99999;
|
||||
const cdnNum = ctx.params.cdn || 5;
|
||||
let cdn = '';
|
||||
if (!isNaN(parseInt(cdnNum)) && 1 <= parseInt(cdnNum) && parseInt(cdnNum) <= 5) {
|
||||
cdn = `https://p${cdnNum}.fzacg.com`;
|
||||
} else {
|
||||
cdn = `https://p5.fzacg.com`;
|
||||
}
|
||||
|
||||
// 获取漫画清单
|
||||
const response = await got(`${host}/api/manhua/${id}`);
|
||||
const data = response.data;
|
||||
|
||||
const chapter_detail = await Promise.all(
|
||||
data.mhlist.splice(0, count).map((item) => {
|
||||
const url = `${host}/api/manhua/${id}/${item.url}`;
|
||||
return ctx.cache.tryGet(url, async () => {
|
||||
const picContent = await get_pic(url);
|
||||
return {
|
||||
title: picContent.chapterTitle,
|
||||
description: art(path.join(__dirname, '../templates/manhua.art'), { pic: picContent.pics, cdn }),
|
||||
link: `${host}/${id}/${item.url}/`,
|
||||
comicTitle: picContent.comicTitle,
|
||||
pubDate: picContent.pubDate,
|
||||
};
|
||||
});
|
||||
})
|
||||
);
|
||||
ctx.state.data = {
|
||||
title: '风之动漫 - ' + chapter_detail[0].comicTitle,
|
||||
link: `${host}/${id}`,
|
||||
description: '风之动漫',
|
||||
item: chapter_detail,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
const fffdm = {
|
||||
title: '在线漫画',
|
||||
docs: 'https://docs.rsshub.app/anime.html#feng-zhi-dong-man',
|
||||
source: ['/manhua/:id', '/:id'],
|
||||
target: '/fffdm/manhua/:id',
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
'fffdm.com': {
|
||||
_name: '风之动漫',
|
||||
manhua: fffdm,
|
||||
www: fffdm,
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/manhua/:id/:cdn?', require('./manhua/manhua'));
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
<div>
|
||||
{{ each pic }}
|
||||
<img src='{{cdn}}/{{$value}}'/><br/>
|
||||
{{/each }}
|
||||
</div>
|
||||
Reference in New Issue
Block a user