增加:AcFun-番剧 (#1000)
* 增加:有品-每日上新 * 修复 summary 字段错误 * 将 youpin 模块转移至 mi 目录下,并更新文档 * 增加:AcFun-番剧
This commit is contained in:
parent
5e8c5aaab1
commit
6a435dc103
|
|
@ -819,6 +819,10 @@ GitHub 官方也提供了一些 RSS:
|
|||
|
||||
<route name="频道" author="xyqfer" example="/youku/channel/UNTg3MTM3OTcy" path="/youku/channel/:channelId/:embed?" :paramsDesc="['频道 id', '默认为开启内嵌视频, 任意值为关闭']"/>
|
||||
|
||||
### AcFun
|
||||
|
||||
<route name="番剧" author="xyqfer" example="/acfun/bangumi/5022158" path="/acfun/bangumi/:id" :paramsDesc="['番剧 id']"/>
|
||||
|
||||
## 图片
|
||||
|
||||
### 妹子图
|
||||
|
|
|
|||
|
|
@ -715,6 +715,9 @@ router.get('/oilprice/:area', require('./routes/oilprice'));
|
|||
router.get('/nhentai/search/:keyword', require('./routes/nhentai/search'));
|
||||
router.get('/nhentai/:key/:keyword', require('./routes/nhentai/other'));
|
||||
|
||||
// AcFun
|
||||
router.get('/acfun/bangumi/:id', require('./routes/acfun/bangumi'));
|
||||
|
||||
// Auto Trader
|
||||
router.get('/autotrader/:query', require('./routes/autotrader'));
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
const axios = require('../../utils/axios');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
const url = `http://www.acfun.cn/bangumi/aa${id}`;
|
||||
|
||||
const bangumiPage = await axios({
|
||||
method: 'get',
|
||||
url,
|
||||
headers: {
|
||||
Referer: 'http://www.acfun.cn',
|
||||
},
|
||||
});
|
||||
const albumInfo = JSON.parse(bangumiPage.data.match(/<script>var albumInfo = (.*)<\/script>/)[1]) || {};
|
||||
const api = `http://www.acfun.cn/album/abm/bangumis/video?albumId=${id}&num=1&size=${albumInfo.contentsCount || 9999}`;
|
||||
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: api,
|
||||
headers: {
|
||||
Referer: 'http://www.acfun.cn',
|
||||
},
|
||||
});
|
||||
const data = response.data.data;
|
||||
|
||||
ctx.state.data = {
|
||||
title: albumInfo.title,
|
||||
link: url,
|
||||
description: albumInfo.intro,
|
||||
item: data.content
|
||||
.map((item) => {
|
||||
const video = item.videos[0] || {};
|
||||
|
||||
return {
|
||||
title: `${video.episodeName}-${video.newTitle}`,
|
||||
description: `<img referrerpolicy="no-referrer" src="${video.image}">`,
|
||||
link: `http://www.acfun.cn/bangumi/ab${id}_${video.groupId}_${video.id}`,
|
||||
pubDate: new Date(video.onlineTime).toUTCString(),
|
||||
};
|
||||
})
|
||||
.reverse(),
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue