mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-19 06:38:55 +08:00
Add anime1 support (#1118)
This commit is contained in:
@@ -993,6 +993,16 @@ GitHub 官方也提供了一些 RSS:
|
||||
|
||||
<route name="文章" author="DIYgod" example="/mygalgame" path="/mygalgame"/>
|
||||
|
||||
### Anime1
|
||||
|
||||
<route name="動畫" author="maple3142" example="/anime1/anime/2018年秋季/哥布林殺手" path="/anime1/anime/:time/:name" :paramsDesc="['时间', '动画名称']">
|
||||
|
||||
时间和动画名称请自己从网址取得: <https://anime1.me/category/2018年秋季/刀劍神域-alicization>
|
||||
|
||||
</route>
|
||||
|
||||
<route name="搜尋" author="maple3142" example="/anime1/search/兔女郎學姊" path="/anime1/search/:keyword" :paramsDesc="['关键字']"/>
|
||||
|
||||
## 程序更新
|
||||
|
||||
### RSSHub
|
||||
|
||||
@@ -787,4 +787,8 @@ router.get('/eeo/:category?', require('./routes/eeo/index'));
|
||||
// 腾讯视频
|
||||
router.get('/tencentvideo/playlist/:id', require('./routes/tencent/video/playlist'));
|
||||
|
||||
// Anime1
|
||||
router.get('/anime1/anime/:time/:name', require('./routes/anime1/anime'));
|
||||
router.get('/anime1/search/:keyword', require('./routes/anime1/search'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
27
routes/anime1/anime.js
Normal file
27
routes/anime1/anime.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { time, name } = ctx.params;
|
||||
const $ = await axios.get(`https://anime1.me/category/${encodeURIComponent(time)}/${encodeURIComponent(name)}`).then((r) => cheerio.load(r.data));
|
||||
const title = $('.page-title')
|
||||
.text()
|
||||
.trim();
|
||||
ctx.state.data = {
|
||||
title,
|
||||
link: `https://anime1.me/category/${time}/${name}`,
|
||||
description: title,
|
||||
item: $('article')
|
||||
.toArray()
|
||||
.map((art) => {
|
||||
const $el = $(art);
|
||||
const title = $el.find('.entry-title a').text();
|
||||
return {
|
||||
title: $el.find('.entry-title a').text(),
|
||||
link: $el.find('.entry-title a').attr('href'),
|
||||
description: title,
|
||||
pubDate: new Date($el.find('time').attr('datetime')).toUTCString(),
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
27
routes/anime1/search.js
Normal file
27
routes/anime1/search.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { keyword } = ctx.params;
|
||||
const $ = await axios.get(`https://anime1.me/?s=${encodeURIComponent(keyword)}`).then((r) => cheerio.load(r.data));
|
||||
const title = $('.page-title')
|
||||
.text()
|
||||
.trim();
|
||||
ctx.state.data = {
|
||||
title,
|
||||
link: `https://anime1.me/?s=${keyword}`,
|
||||
description: title,
|
||||
item: $('article')
|
||||
.toArray()
|
||||
.map((art) => {
|
||||
const $el = $(art);
|
||||
const title = $el.find('.entry-title a').text();
|
||||
return {
|
||||
title: $el.find('.entry-title a').text(),
|
||||
link: $el.find('.entry-title a').attr('href'),
|
||||
description: title,
|
||||
pubDate: new Date($el.find('time').attr('datetime')).toUTCString(),
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user