From 01c058e7d312f63b3ed8783bc348bd411dd5fd15 Mon Sep 17 00:00:00 2001 From: maple Date: Tue, 20 Nov 2018 23:49:36 +0800 Subject: [PATCH] Add: anigamer (#1174) --- docs/README.md | 6 ++++++ router.js | 4 ++++ routes/anigamer/anime.js | 14 ++++++++++++++ routes/anigamer/new_anime.js | 16 ++++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 routes/anigamer/anime.js create mode 100644 routes/anigamer/new_anime.js diff --git a/docs/README.md b/docs/README.md index e449df4a8..c49f375f5 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1062,6 +1062,12 @@ GitHub 官方也提供了一些 RSS: +### 動畫瘋 + + + + + ## 程序更新 ### RSSHub diff --git a/router.js b/router.js index 957e0665d..dc1f969d7 100644 --- a/router.js +++ b/router.js @@ -853,4 +853,8 @@ router.get('/javbus/western/home', require('./routes/javbus/western/home')); router.get('/javbus/western/genre/:gid', require('./routes/javbus/western/genre')); router.get('/javbus/western/star/:sid', require('./routes/javbus/western/star')); +// 動畫瘋 +router.get('/anigamer/new_anime', require('./routes/anigamer/new_anime')); +router.get('/anigamer/anime/:sn', require('./routes/anigamer/anime')); + module.exports = router; diff --git a/routes/anigamer/anime.js b/routes/anigamer/anime.js new file mode 100644 index 000000000..9eb6e35cd --- /dev/null +++ b/routes/anigamer/anime.js @@ -0,0 +1,14 @@ +const axios = require('../../utils/axios'); + +module.exports = async (ctx) => { + const { anime } = await axios.get(`https://api.gamer.com.tw/mobile_app/anime/v1/video.php?sn=0&anime_sn=${ctx.params.sn}`).then((r) => r.data); + ctx.state.data = { + title: anime.title, + link: `https://ani.gamer.com.tw/animeRef.php?sn=${anime.anime_sn}`, + description: anime.content, + item: anime.volumes[0].map((item) => ({ + title: `${anime.title} 第 ${item.volume} 集`, + link: `https://ani.gamer.com.tw/animeVideo.php?sn=${item.video_sn}`, + })), + }; +}; diff --git a/routes/anigamer/new_anime.js b/routes/anigamer/new_anime.js new file mode 100644 index 000000000..e752fa774 --- /dev/null +++ b/routes/anigamer/new_anime.js @@ -0,0 +1,16 @@ +const axios = require('../../utils/axios'); +const { DateTime } = require('luxon'); + +module.exports = async (ctx) => { + const { new_anime } = await axios.get('https://api.gamer.com.tw/mobile_app/anime/v1/index.php').then((r) => r.data); + ctx.state.data = { + title: '動畫瘋最後更新', + link: 'https://ani.gamer.com.tw/', + item: new_anime.date.map((item) => ({ + title: item.title, + description: item.info, + link: `https://ani.gamer.com.tw/animeRef.php?sn=${item.anime_sn}`, + pubDate: DateTime.fromFormat(item.info.split(' ')[0], 'mm/dd').toRFC2822(), + })), + }; +};