diff --git a/assets/radar-rules.js b/assets/radar-rules.js index 5a6d0d3a7..9642eda77 100644 --- a/assets/radar-rules.js +++ b/assets/radar-rules.js @@ -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: [ diff --git a/docs/anime.md b/docs/anime.md index 89ae2d486..e8826dcf5 100644 --- a/docs/anime.md +++ b/docs/anime.md @@ -306,6 +306,18 @@ pageClass: routes +## 看漫画镜像站 + +### 漫画更新 + + + +## 看漫画台湾 + +### 漫画更新 + + + ## 漫画 DB ### 漫画 DB diff --git a/lib/router.js b/lib/router.js index 7bb3bafc6..f3b245a6e 100644 --- a/lib/router.js +++ b/lib/router.js @@ -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 diff --git a/lib/routes/mhgui/comic.js b/lib/routes/mhgui/comic.js new file mode 100644 index 000000000..ae28a1859 --- /dev/null +++ b/lib/routes/mhgui/comic.js @@ -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: ` +

${chapter.num}

+ + `.trim(), + }); + ctx.state.data = { + title: `看漫画 - ${bookTitle}`, + link: `https://www.mhgui.com/comic/${id}/`, + description: bookIntro, + item: chapters.map(genResult), + }; +}; diff --git a/lib/routes/twmanhuagui/comic.js b/lib/routes/twmanhuagui/comic.js new file mode 100644 index 000000000..090645acf --- /dev/null +++ b/lib/routes/twmanhuagui/comic.js @@ -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: ` +

${chapter.num}

+ + `.trim(), + }); + ctx.state.data = { + title: `看漫画 - ${bookTitle}`, + link: `https://tw.manhuagui.com/comic/${id}/`, + description: bookIntro, + item: chapters.map(genResult), + }; +};