feat(route): add 看漫画镜像站 (#7840)
This commit is contained in:
parent
f64a6005a2
commit
6dccdec7f8
|
|
@ -610,6 +610,28 @@
|
|||
},
|
||||
],
|
||||
},
|
||||
'mhgui.com': {
|
||||
_name: '漫画柜镜像站',
|
||||
www: [
|
||||
{
|
||||
title: '漫画更新',
|
||||
docs: 'https://docs.rsshub.app/anime.html#kan-man-hua-jing-xiang-zhan',
|
||||
source: '/comic/:id/',
|
||||
target: '/mhgui/comic/:id',
|
||||
},
|
||||
],
|
||||
},
|
||||
'tw.manhuagui.com': {
|
||||
_name: '漫画柜台湾',
|
||||
www: [
|
||||
{
|
||||
title: '漫画更新',
|
||||
docs: 'https://docs.rsshub.app/anime.html#kan-man-hua-tai-wan',
|
||||
source: '/comic/:id/',
|
||||
target: '/twmanhuagui/comic/:id',
|
||||
},
|
||||
],
|
||||
},
|
||||
'pgyer.com': {
|
||||
_name: '蒲公英应用分发',
|
||||
www: [
|
||||
|
|
|
|||
|
|
@ -306,6 +306,18 @@ pageClass: routes
|
|||
|
||||
<Route author="MegrezZhu" path="/manhuagui/comic/:id" example="/manhuagui/comic/22942" :paramsDesc="['漫画ID']" radar="1" rssbud="1"/>
|
||||
|
||||
## 看漫画镜像站
|
||||
|
||||
### 漫画更新
|
||||
|
||||
<Route author="btdwv" path="/mhgui/comic/:id" example="/mhgui/comic/13317" :paramsDesc="['漫画ID']" radar="1" rssbud="1"/>
|
||||
|
||||
## 看漫画台湾
|
||||
|
||||
### 漫画更新
|
||||
|
||||
<Route author="btdwv" path="/twmanhuagui/comic/:id" example="/twmanhuagui/comic/13317" :paramsDesc="['漫画ID']" radar="1" rssbud="1"/>
|
||||
|
||||
## 漫画 DB
|
||||
|
||||
### 漫画 DB
|
||||
|
|
|
|||
|
|
@ -1134,6 +1134,9 @@ router.get('/tencentvideo/playlist/:id', require('./routes/tencent/video/playlis
|
|||
|
||||
// 看漫画
|
||||
router.get('/manhuagui/comic/:id', require('./routes/manhuagui/comic'));
|
||||
router.get('/mhgui/comic/:id', require('./routes/mhgui/comic'));
|
||||
router.get('/twmanhuagui/comic/:id', require('./routes/twmanhuagui/comic'));
|
||||
|
||||
// 動漫狂
|
||||
router.get('/cartoonmad/comic/:id', require('./routes/cartoonmad/comic'));
|
||||
// Vol
|
||||
|
|
|
|||
|
|
@ -0,0 +1,53 @@
|
|||
const { resolve } = require('url');
|
||||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
const LZString = require('lz-string');
|
||||
|
||||
const getChapters = ($) =>
|
||||
$('.chapter-list > ul')
|
||||
.toArray()
|
||||
.reverse()
|
||||
.reduce((acc, curr) => acc.concat($(curr).children('li').toArray()), [])
|
||||
.map((ele) => {
|
||||
const a = $(ele).children('a');
|
||||
return {
|
||||
link: resolve('https://www.mhgui.com/', a.attr('href')),
|
||||
title: a.attr('title'),
|
||||
num: a.find('i').text(),
|
||||
};
|
||||
});
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
|
||||
const { data } = await got.get(`https://www.mhgui.com/comic/${id}/`);
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
if ($('#__VIEWSTATE').length > 0) {
|
||||
const n = LZString.decompressFromBase64($('#__VIEWSTATE').val());
|
||||
if (n) {
|
||||
$('#erroraudit_show').replaceWith(n);
|
||||
$('#__VIEWSTATE').remove();
|
||||
}
|
||||
}
|
||||
|
||||
const bookTitle = $('.book-title > h1').text();
|
||||
const bookIntro = $('#intro-all').text();
|
||||
const coverImgSrc = $('.book-cover img').attr('src');
|
||||
const chapters = getChapters($);
|
||||
|
||||
const genResult = (chapter) => ({
|
||||
link: chapter.link,
|
||||
title: chapter.title,
|
||||
description: `
|
||||
<h1>${chapter.num}</h1>
|
||||
<img src="${coverImgSrc}" />
|
||||
`.trim(),
|
||||
});
|
||||
ctx.state.data = {
|
||||
title: `看漫画 - ${bookTitle}`,
|
||||
link: `https://www.mhgui.com/comic/${id}/`,
|
||||
description: bookIntro,
|
||||
item: chapters.map(genResult),
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
const { resolve } = require('url');
|
||||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
const LZString = require('lz-string');
|
||||
|
||||
const getChapters = ($) =>
|
||||
$('.chapter-list > ul')
|
||||
.toArray()
|
||||
.reverse()
|
||||
.reduce((acc, curr) => acc.concat($(curr).children('li').toArray()), [])
|
||||
.map((ele) => {
|
||||
const a = $(ele).children('a');
|
||||
return {
|
||||
link: resolve('https://tw.manhuagui.com/', a.attr('href')),
|
||||
title: a.attr('title'),
|
||||
num: a.find('i').text(),
|
||||
};
|
||||
});
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
|
||||
const { data } = await got.get(`https://tw.manhuagui.com/comic/${id}/`);
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
if ($('#__VIEWSTATE').length > 0) {
|
||||
const n = LZString.decompressFromBase64($('#__VIEWSTATE').val());
|
||||
if (n) {
|
||||
$('#erroraudit_show').replaceWith(n);
|
||||
$('#__VIEWSTATE').remove();
|
||||
}
|
||||
}
|
||||
|
||||
const bookTitle = $('.book-title > h1').text();
|
||||
const bookIntro = $('#intro-all').text();
|
||||
const coverImgSrc = $('.book-cover img').attr('src');
|
||||
const chapters = getChapters($);
|
||||
|
||||
const genResult = (chapter) => ({
|
||||
link: chapter.link,
|
||||
title: chapter.title,
|
||||
description: `
|
||||
<h1>${chapter.num}</h1>
|
||||
<img src="${coverImgSrc}" />
|
||||
`.trim(),
|
||||
});
|
||||
ctx.state.data = {
|
||||
title: `看漫画 - ${bookTitle}`,
|
||||
link: `https://tw.manhuagui.com/comic/${id}/`,
|
||||
description: bookIntro,
|
||||
item: chapters.map(genResult),
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue