diff --git a/docs/anime.md b/docs/anime.md index 03586e7de1..4d62f8bea2 100644 --- a/docs/anime.md +++ b/docs/anime.md @@ -90,6 +90,10 @@ +## 鼠绘漫画 + + + ## 嘀哩嘀哩-dilidili diff --git a/lib/router.js b/lib/router.js index 1cc82656f8..54eb997347 100755 --- a/lib/router.js +++ b/lib/router.js @@ -1321,6 +1321,9 @@ router.get('/gradcafe/result', require('./routes/gradcafe/result')); // The Economist router.get('/the-economist/gre-vocabulary', require('./routes/the-economist/gre-vocabulary')); +// 鼠绘漫画 +router.get('/shuhui/comics/:id', require('./routes/shuhui/comics')); + // 朝日新聞中文網 router.get('/asahichinese-f/:category/:subCate', require('./routes/asahichinese-f/index')); router.get('/asahichinese-f/:category', require('./routes/asahichinese-f/index')); diff --git a/lib/routes/shuhui/comics.js b/lib/routes/shuhui/comics.js new file mode 100644 index 0000000000..6e284cc8f5 --- /dev/null +++ b/lib/routes/shuhui/comics.js @@ -0,0 +1,92 @@ +const axios = require('../../utils/axios'); + +module.exports = async (ctx) => { + const id = ctx.params.id; + + let lastEpisodeId; + const rssData = await axios({ + method: 'get', + url: `https://prod-api.ishuhui.com/ver/67715120/anime/detail?id=${id}&type=comics&.json`, + headers: { + Origin: 'https://www.ishuhui.com', + Referer: `https://www.ishuhui.com/comics/anime/${id}`, + }, + }).then(function(response) { + // 漫画名 + const name = response.data.data.name; + // 漫画描述 + const desc = response.data.data.desc; + + const episodeGroup = response.data.data.comicsIndexes['1'].nums; + let lastGroup = '0'; + for (const key in episodeGroup) { + if (parseInt(lastGroup.split('-')[0]) < parseInt(key.split('-')[0])) { + lastGroup = key; + } + } + + // 找到最新章节组 + let lastEpisode = '-1'; + for (const group in episodeGroup[lastGroup]) { + if (parseInt(lastEpisode) < parseInt(group)) { + lastEpisode = group; + } + } + + // 最新章节id + lastEpisodeId = episodeGroup[lastGroup][lastEpisode][0].id; + + return { + name, + desc, + }; + }); + + let description = ''; + const data = await axios({ + method: 'get', + url: `https://prod-api.ishuhui.com/comics/detail?id=${lastEpisodeId}`, + headers: { + Origin: 'https://www.ishuhui.com', + Referer: `https://www.ishuhui.com/comics/detail/${lastEpisodeId}`, + }, + }).then(function(response) { + const picUrlArray = response.data.data.contentImg; + const rssTitle = response.data.data.animeName; + const title = response.data.data.title; + const index = response.data.data.numberEnd; + const updateTime = response.data.data.updateTime; + for (let i = 0; i < picUrlArray.length; i++) { + description += `
`; + } + + const item = { + rssTitle, + title, + description, + index, + updateTime, + }; + return [item]; + }); + + ctx.state.data = { + // 源标题 + title: `${rssData.name}`, + // 源链接 + link: `https://www.ishuhui.com/comics/anime/${id}`, + // 源说明 + description: `${rssData.desc}`, + // 遍历此前获取的数据 + item: data.map((item) => ({ + // 文章标题 + title: `第${item.index}话-${item.title}`, + // 文章正文 + description: item.description, + // 文章发布时间 + pubDate: new Date(item.updateTime).toUTCString(), + // 文章链接 + link: `http://www.hanhuazu.cc/comics/detail/${lastEpisodeId}`, + })), + }; +};