mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-15 10:15:23 +08:00
* Add B站用户频道 closes #370 * Update docs * Update README.md
This commit is contained in:
@@ -19,6 +19,7 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
|||||||
- 番剧
|
- 番剧
|
||||||
- UP 主投稿
|
- UP 主投稿
|
||||||
- UP 主动态
|
- UP 主动态
|
||||||
|
- UP 主频道
|
||||||
- UP 主默认收藏夹
|
- UP 主默认收藏夹
|
||||||
- UP 主非默认收藏夹
|
- UP 主非默认收藏夹
|
||||||
- UP 主投币视频
|
- UP 主投币视频
|
||||||
|
|||||||
@@ -130,6 +130,16 @@ RSSHub 同时支持 RSS 2.0、Atom 和 [JSON Feed](https://jsonfeed.org/) 输出
|
|||||||
|
|
||||||
参数: uid,用户 id,可在 UP 主主页中找到
|
参数: uid,用户 id,可在 UP 主主页中找到
|
||||||
|
|
||||||
|
### UP 主频道
|
||||||
|
|
||||||
|
举例: [https://rsshub.app/bilibili/channel/142821407/23390](https://rsshub.app/bilibili/channel/142821407/23390)
|
||||||
|
|
||||||
|
路由: `/bilibili/channel/:uid/:cid`
|
||||||
|
|
||||||
|
参数: uid,用户 id,可在 UP 主主页中找到
|
||||||
|
|
||||||
|
cid,频道 ID,可在频道的 URL 中找到
|
||||||
|
|
||||||
### UP 主默认收藏夹
|
### UP 主默认收藏夹
|
||||||
|
|
||||||
举例: [https://rsshub.app/bilibili/user/fav/2267573](https://rsshub.app/bilibili/user/fav/2267573)
|
举例: [https://rsshub.app/bilibili/user/fav/2267573](https://rsshub.app/bilibili/user/fav/2267573)
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ router.get('/bilibili/blackboard', require('./routes/bilibili/blackboard'));
|
|||||||
router.get('/bilibili/mall/new', require('./routes/bilibili/mallNew'));
|
router.get('/bilibili/mall/new', require('./routes/bilibili/mallNew'));
|
||||||
router.get('/bilibili/mall/ip/:id', require('./routes/bilibili/mallIP'));
|
router.get('/bilibili/mall/ip/:id', require('./routes/bilibili/mallIP'));
|
||||||
router.get('/bilibili/ranking/:rid?/:day?', require('./routes/bilibili/ranking'));
|
router.get('/bilibili/ranking/:rid?/:day?', require('./routes/bilibili/ranking'));
|
||||||
|
router.get('/bilibili/channel/:uid/:cid', require('./routes/bilibili/userChannel'));
|
||||||
|
|
||||||
// bangumi
|
// bangumi
|
||||||
router.get('/bangumi/calendar/today', require('./routes/bangumi/calendar/today'));
|
router.get('/bangumi/calendar/today', require('./routes/bangumi/calendar/today'));
|
||||||
|
|||||||
36
routes/bilibili/userChannel.js
Normal file
36
routes/bilibili/userChannel.js
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
const axios = require('../../utils/axios');
|
||||||
|
const config = require('../../config');
|
||||||
|
const cache = require('./cache');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const cid = ctx.params.cid;
|
||||||
|
const uid = ctx.params.uid;
|
||||||
|
|
||||||
|
const userName = await cache.getUsernameFromUID(ctx, uid);
|
||||||
|
const host = `https://api.bilibili.com/x/space/channel/video?mid=${uid}&cid=${cid}&pn=1&ps=10&order=0`;
|
||||||
|
|
||||||
|
const response = await axios({
|
||||||
|
method: 'get',
|
||||||
|
url: host,
|
||||||
|
headers: {
|
||||||
|
'User-Agent': config.ua,
|
||||||
|
Referer: `https://space.bilibili.com/${uid}/`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const data = response.data.data.list;
|
||||||
|
|
||||||
|
const channelName = data.name;
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `${userName} 的 bilibili 频道 ${channelName}`,
|
||||||
|
link: `https://space.bilibili.com/${uid}/#/channel/detail?cid=${cid}`,
|
||||||
|
description: data.name,
|
||||||
|
|
||||||
|
item: data.archives.map((item) => ({
|
||||||
|
title: item.title,
|
||||||
|
description: `${item.desc}<br><img referrerpolicy="no-referrer" src="${item.pic}">`,
|
||||||
|
pubDate: new Date(item.fav_at * 1000).toUTCString(),
|
||||||
|
link: `https://www.bilibili.com/video/av${item.aid}`,
|
||||||
|
})),
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user