diff --git a/assets/radar-rules.js b/assets/radar-rules.js
index 4110d95b3..01f701b6f 100644
--- a/assets/radar-rules.js
+++ b/assets/radar-rules.js
@@ -250,9 +250,10 @@
'ishuhui.com': { _name: '鼠绘漫画', www: [{ title: '鼠绘漫画', docs: 'https://docs.rsshub.app/anime.html#shu-hui-man-hua', source: '/comics/anime/:id', target: '/shuhui/comics/:id' }] },
'www.chicagotribune.com': { _name: 'Chicago Tribune', www: [{ title: 'Chicago Tribune', docs: 'https://docs.rsshub.app/traditional_media.html#chicago-tribune', source: '/' }] },
'haimaoba.com': { _name: '海猫吧', www: [{ title: '漫画更新', docs: 'https://docs.rsshub.app/anime.html#hai-mao-ba', source: '/catalog/:id', target: '/haimaoba/:id' }] },
- 'manhuagui.com': { _name: '漫画柜', www: [{ title: '漫画更新', docs: 'https://docs.rsshub.app/anime.html#kan-man-hua', source: '/comic/:id/', target: '/manhuagui/comic/:id' }] },
- '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' }] },
+ 'manhuagui.com': { _name: '漫画柜', www: [{ title: '漫画更新', docs: 'https://docs.rsshub.app/anime.html#kan-man-hua', source: '/comic/:id/', target: '/manhuagui/comic/:id/5' }] },
+ '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/5' }] },
'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' }] },
+ 'copymanga.com': { _name: '拷贝漫画', www: [{ title: '漫画更新', docs: 'https://docs.rsshub.app/anime.html#kao-bei-man-hua', source: '/comic/:id/', target: '/manhuagui/comic/:id/5' }] },
'pgyer.com': { _name: '蒲公英应用分发', www: [{ title: 'app更新', docs: 'https://docs.rsshub.app/program-update.html#pu-gong-ying-ying-yong-fen-fa', source: '/:app', target: '/pgyer/:app' }] },
'pianyuan.la': { _name: '片源网', '.': [{ title: '电影和剧集', docs: 'https://docs.rsshub.app/multimedia.html#pian-yuan', source: '/' }] },
'sspai.com': {
diff --git a/docs/anime.md b/docs/anime.md
index c16af579c..633f64fbd 100644
--- a/docs/anime.md
+++ b/docs/anime.md
@@ -407,25 +407,25 @@ Sources
### 漫画更新
-
+
## 看漫画镜像站
### 漫画更新
-
+
## 看漫画台湾
### 漫画更新
-
+
## 拷贝漫画
### 漫画更新
-
+
## 漫画 DB
diff --git a/lib/router.js b/lib/router.js
index 14961c33d..774a2b8eb 100644
--- a/lib/router.js
+++ b/lib/router.js
@@ -1122,9 +1122,11 @@ router.get('/eeo/:column?/:category?', lazyloadRouteHandler('./routes/eeo/index'
router.get('/tencentvideo/playlist/:id', lazyloadRouteHandler('./routes/tencent/video/playlist'));
// 看漫画
-router.get('/manhuagui/comic/:id', lazyloadRouteHandler('./routes/manhuagui/comic'));
-router.get('/mhgui/comic/:id', lazyloadRouteHandler('./routes/mhgui/comic'));
-router.get('/twmanhuagui/comic/:id', lazyloadRouteHandler('./routes/twmanhuagui/comic'));
+router.get('/manhuagui/comic/:id/:chapterCnt?', lazyloadRouteHandler('./routes/manhuagui/comic'));
+router.get('/mhgui/comic/:id/:chapterCnt?', lazyloadRouteHandler('./routes/mhgui/comic'));
+router.get('/twmanhuagui/comic/:id/:chapterCnt?', lazyloadRouteHandler('./routes/twmanhuagui/comic'));
+// 拷贝漫画
+router.get('/copymanga/comic/:id/:chapterCnt?', lazyloadRouteHandler('./routes/copymanga/comic'));
// 拷贝漫画
router.get('/copymanga/comic/:id', lazyloadRouteHandler('./routes/copymanga/comic'));
diff --git a/lib/routes/copymanga/comic.js b/lib/routes/copymanga/comic.js
index c5697f8ff..846180c55 100644
--- a/lib/routes/copymanga/comic.js
+++ b/lib/routes/copymanga/comic.js
@@ -4,7 +4,8 @@ const got = require('@/utils/got');
// 直接调用拷贝漫画的接口
module.exports = async (ctx) => {
const { id } = ctx.params;
-
+ // 用于控制返回的章节数量
+ const chapterCnt = Number(ctx.params.chapterCnt || 0);
// 获取漫画列表
let bHasNextPage = false;
const iReqLimit = (ctx.queries && ctx.queries.limit) || 100;
@@ -62,6 +63,6 @@ module.exports = async (ctx) => {
title: `拷贝漫画 - ${bookTitle}`,
link: `https://copymanga.com/comic/${id}`,
description: bookIntro,
- item: chapterArray.map(genResult),
+ item: chapterArray.map(genResult).slice(0, chapterCnt),
};
};
diff --git a/lib/routes/manhuagui/comic.js b/lib/routes/manhuagui/comic.js
index 5fef23310..f7698b750 100644
--- a/lib/routes/manhuagui/comic.js
+++ b/lib/routes/manhuagui/comic.js
@@ -3,23 +3,47 @@ const cheerio = require('cheerio');
const got = require('@/utils/got');
const LZString = require('lz-string');
-const getChapters = ($) =>
- $('.chapter-list > ul')
+const getChapters = ($) => {
+ let time_mark = 100;
+ // 用于一次更新多个新章节的排序
+ let new_time_mark = 0;
+ return $('h4')
.toArray()
- .reverse()
- .reduce((acc, curr) => acc.concat($(curr).children('li').toArray()), [])
.map((ele) => {
- const a = $(ele).children('a');
- return {
- link: resolve('https://www.manhuagui.com/', a.attr('href')),
- title: a.attr('title'),
- num: a.find('i').text(),
- };
- });
-
+ const categoryName = $(ele).text();
+ while (!$(ele.next).hasClass('chapter-list')) {
+ ele = ele.next;
+ }
+ ele = ele.next;
+ return $(ele)
+ .children('ul')
+ .toArray()
+ .reverse()
+ .reduce((acc, curr) => acc.concat($(curr).children('li').toArray()), [])
+ .map((ele) => {
+ const a = $(ele).children('a');
+ // 通过操作发布时间来对章节进行排序,如果是刚刚更新的单行本或者番外,保留最新更新时间
+ let pDate = new Date(new Date($.pubDate) - time_mark++ * 1000);
+ if (a.find('em').length > 0) {
+ // 对更新的章节也进行排序
+ pDate = new Date(new Date($.pubDate) - new_time_mark++ * 1000);
+ $.newChapterCnt++;
+ }
+ return {
+ link: resolve('https://www.manhuagui.com/', a.attr('href')),
+ title: a.attr('title'),
+ pub_date: pDate,
+ num: a.find('i').text(),
+ guid: resolve('https://www.manhuagui.com/', a.attr('href')),
+ category: categoryName,
+ };
+ });
+ })
+ .reduce((acc, curr) => acc.concat(curr));
+};
module.exports = async (ctx) => {
const { id } = ctx.params;
-
+ const chapterCnt = Number(ctx.params.chapterCnt || 0);
const { data } = await got.get(`https://www.manhuagui.com/comic/${id}/`);
const $ = cheerio.load(data);
@@ -30,24 +54,46 @@ module.exports = async (ctx) => {
$('#__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: `
+ // 对最新更新的章节增加了pubDate
+ const reg = new RegExp('最近于.+更新至');
+ // 处理已下架的漫画
+ if ($('.status > span').text().indexOf('已下架') > 0) {
+ ctx.state.data = {
+ title: `看漫画 - ${bookTitle} 已下架`,
+ link: `https://www.manhuagui.com/comic/${id}/`,
+ description: bookIntro,
+ item: [{ link: `https://www.manhuagui.com/comic/${id}/`, title: bookTitle, description: '已下架' }],
+ };
+ } else {
+ const pub_date_str = $('.status > span').text().match(reg)[0].replace('最近于 [', '').replace('] 更新至', '');
+ // 为了能在闭包内访问到这个日期而不是每次需要处理这个最近更新日期
+ $.pubDate = new Date(pub_date_str).toUTCString();
+ $.newChapterCnt = 0;
+ const chapters = getChapters($);
+ const genResult = (chapter) => ({
+ link: chapter.link,
+ title: chapter.title,
+ pubDate: chapter.pub_date,
+ guid: chapter.guid,
+ category: chapter.category,
+ description: `
${chapter.num}
-
+
`.trim(),
- });
- ctx.state.data = {
- title: `看漫画 - ${bookTitle}`,
- link: `https://www.manhuagui.com/comic/${id}/`,
- description: bookIntro,
- item: chapters.map(genResult),
- };
+ });
+ const items = chapters.map(genResult);
+ let itemsLen = items.length;
+ if (chapterCnt > 0) {
+ itemsLen = (chapterCnt < $.newChapterCnt) ? $.newChapterCnt : chapterCnt;
+ }
+ ctx.state.data = {
+ title: `看漫画 - ${bookTitle}`,
+ link: `https://www.manhuagui.com/comic/${id}/`,
+ description: bookIntro,
+ item: items.slice(0, itemsLen),
+ };
+ }
};
diff --git a/lib/routes/mhgui/comic.js b/lib/routes/mhgui/comic.js
index ae28a1859..3cfd056bd 100644
--- a/lib/routes/mhgui/comic.js
+++ b/lib/routes/mhgui/comic.js
@@ -3,23 +3,47 @@ const cheerio = require('cheerio');
const got = require('@/utils/got');
const LZString = require('lz-string');
-const getChapters = ($) =>
- $('.chapter-list > ul')
+const getChapters = ($) => {
+ let time_mark = 0;
+ // 用于一次更新多个新章节的排序
+ let new_time_mark = 0;
+ return $('h4')
.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(),
- };
- });
-
+ const categoryName = $(ele).text();
+ while (!$(ele.next).hasClass('chapter-list')) {
+ ele = ele.next;
+ }
+ ele = ele.next;
+ return $(ele)
+ .children('ul')
+ .toArray()
+ .reverse()
+ .reduce((acc, curr) => acc.concat($(curr).children('li').toArray()), [])
+ .map((ele) => {
+ const a = $(ele).children('a');
+ // 通过操作发布时间来对章节进行排序,如果是刚刚更新的单行本或者番外,保留最新更新时间
+ let pDate = new Date(new Date($.pubDate) - time_mark++ * 1000);
+ if (a.find('em').length > 0) {
+ // 对更新的章节也进行排序
+ pDate = new Date(new Date($.pubDate) - new_time_mark++ * 1000);
+ $.newChapterCnt++;
+ }
+ return {
+ link: resolve('https://www.mhgui.com/', a.attr('href')),
+ title: a.attr('title'),
+ pub_date: pDate,
+ num: a.find('i').text(),
+ guid: resolve('https://www.mhgui.com/', a.attr('href')),
+ category: categoryName,
+ };
+ });
+ })
+ .reduce((acc, curr) => acc.concat(curr));
+};
module.exports = async (ctx) => {
const { id } = ctx.params;
-
+ const chapterCnt = Number(ctx.params.chapterCnt || 0);
const { data } = await got.get(`https://www.mhgui.com/comic/${id}/`);
const $ = cheerio.load(data);
@@ -30,24 +54,46 @@ module.exports = async (ctx) => {
$('#__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: `
+ // 对最新更新的章节增加了pubDate
+ const reg = new RegExp('最近于.+更新至');
+ // 处理已下架的漫画
+ if ($('.status > span').text().indexOf('已下架') > 0) {
+ ctx.state.data = {
+ title: `看漫画 - ${bookTitle} 已下架`,
+ link: `https://www.mhgui.com/comic/${id}/`,
+ description: bookIntro,
+ item: [{ link: `https://www.mhgui.com/comic/${id}/`, title: bookTitle, description: '已下架' }],
+ };
+ } else {
+ const pub_date_str = $('.status > span').text().match(reg)[0].replace('最近于 [', '').replace('] 更新至', '');
+ // 为了能在闭包内访问到这个日期而不是每次需要处理这个最近更新日期
+ $.pubDate = new Date(pub_date_str).toUTCString();
+ $.newChapterCnt = 0;
+ const chapters = getChapters($);
+ const genResult = (chapter) => ({
+ link: chapter.link,
+ title: chapter.title,
+ pubDate: chapter.pub_date,
+ guid: chapter.guid,
+ category: chapter.category,
+ description: `
${chapter.num}
-
+
`.trim(),
- });
- ctx.state.data = {
- title: `看漫画 - ${bookTitle}`,
- link: `https://www.mhgui.com/comic/${id}/`,
- description: bookIntro,
- item: chapters.map(genResult),
- };
+ });
+ const items = chapters.map(genResult);
+ let itemsLen = items.length;
+ if (chapterCnt > 0) {
+ itemsLen = (chapterCnt < $.newChapterCnt) ? $.newChapterCnt : chapterCnt;
+ }
+ ctx.state.data = {
+ title: `看漫画 - ${bookTitle}`,
+ link: `https://www.mhgui.com/comic/${id}/`,
+ description: bookIntro,
+ item: items.slice(0, itemsLen),
+ };
+ }
};
diff --git a/lib/routes/twmanhuagui/comic.js b/lib/routes/twmanhuagui/comic.js
index 090645acf..a303f0ce9 100644
--- a/lib/routes/twmanhuagui/comic.js
+++ b/lib/routes/twmanhuagui/comic.js
@@ -3,23 +3,47 @@ const cheerio = require('cheerio');
const got = require('@/utils/got');
const LZString = require('lz-string');
-const getChapters = ($) =>
- $('.chapter-list > ul')
+const getChapters = ($) => {
+ let time_mark = 0;
+ // 用于一次更新多个新章节的排序
+ let new_time_mark = 0;
+ return $('h4')
.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(),
- };
- });
-
+ const categoryName = $(ele).text();
+ while (!$(ele.next).hasClass('chapter-list')) {
+ ele = ele.next;
+ }
+ ele = ele.next;
+ return $(ele)
+ .children('ul')
+ .toArray()
+ .reverse()
+ .reduce((acc, curr) => acc.concat($(curr).children('li').toArray()), [])
+ .map((ele) => {
+ const a = $(ele).children('a');
+ // 通过操作发布时间来对章节进行排序,如果是刚刚更新的单行本或者番外,保留最新更新时间
+ let pDate = new Date(new Date($.pubDate) - time_mark++ * 1000);
+ if (a.find('em').length > 0) {
+ // 对更新的章节也进行排序
+ pDate = new Date(new Date($.pubDate) - new_time_mark++ * 1000);
+ $.newChapterCnt++;
+ }
+ return {
+ link: resolve('https://tw.manhuagui.com/', a.attr('href')),
+ title: a.attr('title'),
+ pub_date: pDate,
+ num: a.find('i').text(),
+ guid: resolve('https://tw.manhuagui.com/', a.attr('href')),
+ category: categoryName,
+ };
+ });
+ })
+ .reduce((acc, curr) => acc.concat(curr));
+};
module.exports = async (ctx) => {
const { id } = ctx.params;
-
+ const chapterCnt = Number(ctx.params.chapterCnt || 0);
const { data } = await got.get(`https://tw.manhuagui.com/comic/${id}/`);
const $ = cheerio.load(data);
@@ -30,24 +54,46 @@ module.exports = async (ctx) => {
$('#__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: `
+ // 对最新更新的章节增加了pubDate
+ const reg = new RegExp('最近於.+更新至');
+ // 处理已下架的漫画
+ if ($('.status > span').text().indexOf('已下架') > 0) {
+ ctx.state.data = {
+ title: `看漫画 - ${bookTitle} 已下架`,
+ link: `https://tw.manhuagui.com/comic/${id}/`,
+ description: bookIntro,
+ item: [{ link: `https://tw.manhuagui.com/comic/${id}/`, title: bookTitle, description: '已下架' }],
+ };
+ } else {
+ const pub_date_str = $('.status > span').text().match(reg)[0].replace('最近於 [', '').replace('] 更新至', '');
+ // 为了能在闭包内访问到这个日期而不是每次需要处理这个最近更新日期
+ $.pubDate = new Date(pub_date_str).toUTCString();
+ $.newChapterCnt = 0;
+ const chapters = getChapters($);
+ const genResult = (chapter) => ({
+ link: chapter.link,
+ title: chapter.title,
+ pubDate: chapter.pub_date,
+ guid: chapter.guid,
+ category: chapter.category,
+ description: `
${chapter.num}
-
+
`.trim(),
- });
- ctx.state.data = {
- title: `看漫画 - ${bookTitle}`,
- link: `https://tw.manhuagui.com/comic/${id}/`,
- description: bookIntro,
- item: chapters.map(genResult),
- };
+ });
+ const items = chapters.map(genResult);
+ let itemsLen = items.length;
+ if (chapterCnt > 0) {
+ itemsLen = (chapterCnt < $.newChapterCnt) ? $.newChapterCnt : chapterCnt;
+ }
+ ctx.state.data = {
+ title: `看漫画 - ${bookTitle}`,
+ link: `https://tw.manhuagui.com/comic/${id}/`,
+ description: bookIntro,
+ item: items.slice(0, itemsLen),
+ };
+ }
};