mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 23:00:48 +08:00
添加路由動漫狂|add router for (https://www.cartoonmad.com) (#1442)
添加路由動漫狂|add router for (https://www.cartoonmad.com) 测试通过: 1.别当欧尼酱了(https://www.cartoonmad.com/comic/5827) 2.第一次的Gal(https://www.cartoonmad.com/comic/5107)
This commit is contained in:
@@ -1113,6 +1113,10 @@ GitHub 官方也提供了一些 RSS:
|
|||||||
|
|
||||||
<route name="漫画更新" author="MegrezZhu" path="/manhuagui/comic/:id" example="/manhuagui/comic/22942" :paramsDesc="['漫画ID']"/>
|
<route name="漫画更新" author="MegrezZhu" path="/manhuagui/comic/:id" example="/manhuagui/comic/22942" :paramsDesc="['漫画ID']"/>
|
||||||
|
|
||||||
|
### 動畫狂
|
||||||
|
|
||||||
|
<route name="漫画更新" author="KellyHwong" path="/cartoonmad/comic/:id" example="/cartoonmad/comic/5827" :paramsDesc="['漫画ID']"/>
|
||||||
|
|
||||||
### Anime1
|
### Anime1
|
||||||
|
|
||||||
<route name="動畫" author="maple3142" example="/anime1/anime/2018年秋季/哥布林殺手" path="/anime1/anime/:time/:name" :paramsDesc="['时间', '动画名称']">
|
<route name="動畫" author="maple3142" example="/anime1/anime/2018年秋季/哥布林殺手" path="/anime1/anime/:time/:name" :paramsDesc="['时间', '动画名称']">
|
||||||
|
|||||||
@@ -876,6 +876,8 @@ router.get('/tencentvideo/playlist/:id', require('./routes/tencent/video/playlis
|
|||||||
|
|
||||||
// 看漫画
|
// 看漫画
|
||||||
router.get('/manhuagui/comic/:id', require('./routes/manhuagui/comic'));
|
router.get('/manhuagui/comic/:id', require('./routes/manhuagui/comic'));
|
||||||
|
// 動漫狂
|
||||||
|
router.get('/cartoonmad/comic/:id', require('./routes/cartoonmad/comic'));
|
||||||
|
|
||||||
// Tits Guru
|
// Tits Guru
|
||||||
router.get('/tits-guru/home', require('./routes/titsguru/home'));
|
router.get('/tits-guru/home', require('./routes/titsguru/home'));
|
||||||
|
|||||||
58
lib/routes/cartoonmad/comic.js
Normal file
58
lib/routes/cartoonmad/comic.js
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
const { resolve } = require('url');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
const axios = require('../../utils/axios');
|
||||||
|
const iconv = require('iconv-lite');
|
||||||
|
|
||||||
|
const getChapters = ($) =>
|
||||||
|
$('#info')
|
||||||
|
.eq(1)
|
||||||
|
.find('a')
|
||||||
|
.map((_, ele) => {
|
||||||
|
const a = $(ele);
|
||||||
|
return {
|
||||||
|
link: resolve('https://www.cartoonmad.com/', a.attr('href')),
|
||||||
|
title: a.text(),
|
||||||
|
num: a
|
||||||
|
.parent()
|
||||||
|
.find('font')
|
||||||
|
.text(),
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.toArray();
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const { id } = ctx.params;
|
||||||
|
|
||||||
|
const { data } = await axios.get(`https://www.cartoonmad.com/comic/${id}`, { responseType: 'arraybuffer' });
|
||||||
|
const content = iconv.decode(new Buffer.from(data), 'big5');
|
||||||
|
const $ = cheerio.load(content);
|
||||||
|
|
||||||
|
const bookTitle = $('title')
|
||||||
|
.text()
|
||||||
|
.match(/\S+/)[0];
|
||||||
|
const bookIntro = $('#info')
|
||||||
|
.eq(0)
|
||||||
|
.find('td')
|
||||||
|
.text()
|
||||||
|
.trim();
|
||||||
|
const coverImgSrc = $('.cover')
|
||||||
|
.parent()
|
||||||
|
.find('img')
|
||||||
|
.attr('src');
|
||||||
|
const chapters = getChapters($);
|
||||||
|
|
||||||
|
const genResult = (chapter) => ({
|
||||||
|
link: chapter.link,
|
||||||
|
title: chapter.title,
|
||||||
|
description: `
|
||||||
|
<h1>${chapter.num}</h1>
|
||||||
|
<img referrerpolicy="no-referrer" src="${coverImgSrc}" />
|
||||||
|
`.trim(),
|
||||||
|
});
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `動漫狂 - ${bookTitle}`,
|
||||||
|
link: `https://www.cartoonmad.com/comic/${id}`,
|
||||||
|
description: bookIntro,
|
||||||
|
item: chapters.map(genResult),
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user