mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-15 18:30:53 +08:00
fix(route/bilibili): user/followings & user/followers now require login (#12802)
* Update router.js change followers/followings params * Update followers.js add login for followers * Update followings.js add login for followings * Update social-media.md update bilibili/followers bilibili/followings docs * Update followers.js Using camelCase. Adding Document link. Cookie check before declaring `uid `. * Update followings.js Using camelCase. Adding Document link. Cookie check before declaring `uid `. * Update maintainer.js * Update README.md Add docs for bilibili/user/followings & bilibili/user/followers * Update router.js Using camelCase * Update social-media.md * style: auto format * Update social-media.md --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@@ -718,7 +718,7 @@ RSSHub 支持使用访问密钥 / 码,白名单和黑名单三种方式进行
|
||||
1. 打开 <https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_new?uid=0&type=8>
|
||||
2. 打开控制台,切换到 Network 面板,刷新
|
||||
3. 点击 dynamic_new 请求,找到 Cookie
|
||||
4. 视频和专栏只要求 `SESSDATA` 字段,动态需复制整段 Cookie
|
||||
4. 视频和专栏,UP 主粉丝及关注只要求 `SESSDATA` 字段,动态需复制整段 Cookie
|
||||
|
||||
- Bitbucket: [Basic auth with App passwords](https://developer.atlassian.com/cloud/bitbucket/rest/intro/#basic-auth)
|
||||
|
||||
|
||||
@@ -70,11 +70,27 @@ Tiny Tiny RSS 会给所有 iframe 元素添加 `sandbox="allow-scripts"` 属性
|
||||
|
||||
### UP 主粉丝
|
||||
|
||||
<Route author="Qixingchen" example="/bilibili/user/followers/2267573" path="/bilibili/user/followers/:uid" :paramsDesc="['用户 id, 可在 UP 主主页中找到']" radar="1" rssbud="1"/>
|
||||
<Route author="Qixingchen" example="/bilibili/user/followers/2267573/3" path="/bilibili/user/followers/:uid/:loginUid" :paramsDesc="['用户 id, 可在 UP 主主页中找到','用于登入的用户id,需要配置对应的 Cookie 值']" radar="1" rssbud="1" selfhost="1">
|
||||
|
||||
::: warning 注意
|
||||
|
||||
UP 主粉丝现在需要 b 站登录后的 Cookie 值,所以只能自建,详情见部署页面的配置模块。
|
||||
|
||||
:::
|
||||
|
||||
</Route>
|
||||
|
||||
### UP 主关注用户
|
||||
|
||||
<Route author="Qixingchen" example="/bilibili/user/followings/2267573" path="/bilibili/user/followings/:uid" :paramsDesc="['用户 id, 可在 UP 主主页中找到']" radar="1" rssbud="1"/>
|
||||
<Route author="Qixingchen" example="/bilibili/user/followings/2267573/3" path="/bilibili/user/followings/:uid/:loginUid" :paramsDesc="['用户 id, 可在 UP 主主页中找到','用于登入的用户id,需要配置对应的 Cookie 值']" radar="1" rssbud="1" selfhost="1">
|
||||
|
||||
::: warning 注意
|
||||
|
||||
UP 主关注用户现在需要 b 站登录后的 Cookie 值,所以只能自建,详情见部署页面的配置模块。
|
||||
|
||||
:::
|
||||
|
||||
</Route>
|
||||
|
||||
### 分区视频
|
||||
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
const got = require('@/utils/got');
|
||||
const cache = require('./cache');
|
||||
const config = require('@/config').value;
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const uid = ctx.params.uid;
|
||||
const loginUid = ctx.params.loginUid;
|
||||
|
||||
const cookie = config.bilibili.cookies[loginUid];
|
||||
if (cookie === undefined) {
|
||||
throw Error('缺少对应 loginUid 的 Bilibili 用户登录后的 Cookie 值 <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">bilibili 用户关注动态系列路由</a>');
|
||||
}
|
||||
|
||||
const name = await cache.getUsernameFromUID(ctx, uid);
|
||||
|
||||
@@ -20,8 +27,12 @@ module.exports = async (ctx) => {
|
||||
url: `https://api.bilibili.com/x/relation/followers?vmid=${uid}`,
|
||||
headers: {
|
||||
Referer: `https://space.bilibili.com/${uid}/`,
|
||||
Cookie: cookie,
|
||||
},
|
||||
});
|
||||
if (response.data.code === -6 || response.data.code === -101) {
|
||||
throw Error('对应 loginUid 的 Bilibili 用户的 Cookie 已过期');
|
||||
}
|
||||
const data = response.data.data.list;
|
||||
|
||||
ctx.state.data = {
|
||||
@@ -31,7 +42,7 @@ module.exports = async (ctx) => {
|
||||
item: data.map((item) => ({
|
||||
title: `${name} 新粉丝 ${item.uname}`,
|
||||
description: `${item.uname}<br>${item.sign}<br>总计${count}`,
|
||||
pubDate: new Date(item.mtime * 1000).toUTCString(),
|
||||
pubDate: new Date(item.mtime * 1000),
|
||||
link: `https://space.bilibili.com/${item.mid}`,
|
||||
})),
|
||||
};
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
const got = require('@/utils/got');
|
||||
const cache = require('./cache');
|
||||
const config = require('@/config').value;
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const loginUid = ctx.params.loginUid;
|
||||
const cookie = config.bilibili.cookies[loginUid];
|
||||
if (cookie === undefined) {
|
||||
throw Error('缺少对应 loginUid 的 Bilibili 用户登录后的 Cookie 值 <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">bilibili 用户关注动态系列路由</a>');
|
||||
}
|
||||
|
||||
const uid = ctx.params.uid;
|
||||
const name = await cache.getUsernameFromUID(ctx, uid);
|
||||
|
||||
@@ -19,8 +26,16 @@ module.exports = async (ctx) => {
|
||||
url: `https://api.bilibili.com/x/relation/followings?vmid=${uid}`,
|
||||
headers: {
|
||||
Referer: `https://space.bilibili.com/${uid}/`,
|
||||
Cookie: cookie,
|
||||
},
|
||||
});
|
||||
if (response.data.code === -6) {
|
||||
throw Error('对应 loginUid 的 Bilibili 用户的 Cookie 已过期');
|
||||
}
|
||||
// 22115 : 用户已设置隐私,无法查看
|
||||
if (response.data.code === 22115) {
|
||||
throw Error(response.data.message);
|
||||
}
|
||||
const data = response.data.data.list;
|
||||
|
||||
ctx.state.data = {
|
||||
@@ -30,7 +45,7 @@ module.exports = async (ctx) => {
|
||||
item: data.map((item) => ({
|
||||
title: `${name} 新关注 ${item.uname}`,
|
||||
description: `${item.uname}<br>${item.sign}<br>总计${count}`,
|
||||
pubDate: new Date(item.mtime * 1000).toUTCString(),
|
||||
pubDate: new Date(item.mtime * 1000),
|
||||
link: `https://space.bilibili.com/${item.mid}`,
|
||||
})),
|
||||
};
|
||||
|
||||
@@ -31,8 +31,8 @@ module.exports = {
|
||||
'/user/collection/:uid/:sid/:disableEmbed?': ['shininome'],
|
||||
'/user/dynamic/:uid/:disableEmbed?': ['DIYgod', 'zytomorrow'],
|
||||
'/user/fav/:uid/:disableEmbed?': ['DIYgod'],
|
||||
'/user/followers/:uid': ['Qixingchen'],
|
||||
'/user/followings/:uid': ['Qixingchen'],
|
||||
'/user/followers/:uid/:loginUid': ['Qixingchen'],
|
||||
'/user/followings/:uid/:loginUid': ['Qixingchen'],
|
||||
'/user/video/:uid/:disableEmbed?': ['DIYgod'],
|
||||
'/user/video-all/:uid/:disableEmbed?': ['CcccFz'],
|
||||
'/video/danmaku/:bvid/:pid?': ['Qixingchen'],
|
||||
|
||||
@@ -31,8 +31,8 @@ module.exports = (router) => {
|
||||
router.get('/user/collection/:uid/:sid/:disableEmbed?', require('./userCollection'));
|
||||
router.get('/user/dynamic/:uid/:disableEmbed?', require('./dynamic'));
|
||||
router.get('/user/fav/:uid/:disableEmbed?', require('./userFav'));
|
||||
router.get('/user/followers/:uid', require('./followers'));
|
||||
router.get('/user/followings/:uid', require('./followings'));
|
||||
router.get('/user/followers/:uid/:loginUid', require('./followers'));
|
||||
router.get('/user/followings/:uid/:loginUid', require('./followings'));
|
||||
router.get('/user/video/:uid/:disableEmbed?', require('./video'));
|
||||
router.get('/user/video-all/:uid/:disableEmbed?', require('./video-all'));
|
||||
router.get('/video/danmaku/:bvid/:pid?', require('./danmaku'));
|
||||
|
||||
Reference in New Issue
Block a user