add bilibili video list (#1556)

This commit is contained in:
三咲智子
2019-02-19 15:10:01 +08:00
committed by DIYgod
parent f7a31fd758
commit a48ac252b7
3 changed files with 30 additions and 0 deletions

View File

@@ -149,6 +149,7 @@ RSSHub 提供下列 API 接口:
"/bilibili/partion/:tid",
"/bilibili/partion/ranking/:tid/:days?",
"/bilibili/bangumi/:seasonid",
"/bilibili/video/page/:aid",
"/bilibili/video/reply/:aid",
"/bilibili/link/news/:product",
"/bilibili/live/room/:roomID",
@@ -295,6 +296,8 @@ RSSHub 提供下列 API 接口:
<route name="分区视频排行榜" author="lengthmin" example="/bilibili/partion/ranking/171/3" path="/bilibili/partion/ranking/:tid/:days?" :paramsDesc="['分区 id, 见上方表格', '缺省为 7, 指最近多少天内的热度排序']"/>
<route name="视频选集列表" author="sxzz" example="/bilibili/video/page/39732828" path="/bilibili/video/page/:aid" :paramsDesc="['可在视频页 URL 中找到']"/>
<route name="视频评论" author="Qixingchen" example="/bilibili/video/reply/21669336" path="/bilibili/video/reply/:aid" :paramsDesc="['可在视频页 URL 中找到']"/>
<route name="视频弹幕" author="Qixingchen" example="/bilibili/video/danmaku/21669336/1" path="/bilibili/video/danmaku/:aid/:pid?" :paramsDesc="['视频AV号,可在视频页 URL 中找到','分P号,不填默认为1']"/>

View File

@@ -104,6 +104,7 @@ router.get('/bilibili/partion/:tid', require('./routes/bilibili/partion'));
router.get('/bilibili/partion/ranking/:tid/:days?', require('./routes/bilibili/partion-ranking'));
router.get('/bilibili/bangumi/:seasonid', require('./routes/bilibili/bangumi')); // 弃用
router.get('/bilibili/bangumi/media/:mediaid', require('./routes/bilibili/bangumi'));
router.get('/bilibili/video/page/:aid', require('./routes/bilibili/page'));
router.get('/bilibili/video/reply/:aid', require('./routes/bilibili/reply'));
router.get('/bilibili/video/danmaku/:aid/:pid?', require('./routes/bilibili/danmaku'));
router.get('/bilibili/link/news/:product', require('./routes/bilibili/linkNews'));

View File

@@ -0,0 +1,26 @@
const axios = require('../../utils/axios');
module.exports = async (ctx) => {
const aid = ctx.params.aid;
const response = await axios({
method: 'get',
url: `https://api.bilibili.com/x/web-interface/view?aid=${aid}`,
headers: {
Referer: `https://www.bilibili.com/video/av${aid}`,
},
});
const { title: name, pages: data } = response.data.data;
ctx.state.data = {
title: `视频 ${name} 的选集列表`,
link: `https://www.bilibili.com/video/av${aid}`,
description: `视频 ${name} 的视频选集列表`,
item: data.map((item) => ({
title: item.part,
description: `${item.part} - ${name}`,
pubDate: new Date().toUTCString(),
link: `https://www.bilibili.com/video/av${aid}?p=${item.page}`,
})),
};
};