feat(route): 优化微博博主路由 (#14365)

This commit is contained in:
CaoMeiYouRen 2024-02-01 19:38:17 +08:00 committed by GitHub
parent a1237057b5
commit 002302fae0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 3 deletions

View File

@ -21,7 +21,6 @@ module.exports = async (ctx) => {
displayComments = fallback(undefined, queryToBoolean(routeParams.displayComments), false) ? '1' : '0';
}
}
const containerData = await ctx.cache.tryGet(
`weibo:user:index:${uid}`,
async () => {
@ -32,6 +31,7 @@ module.exports = async (ctx) => {
Referer: `https://m.weibo.cn/u/${uid}`,
'MWeibo-Pwa': 1,
'X-Requested-With': 'XMLHttpRequest',
Cookie: config.weibo.cookies,
},
});
return _r.data;
@ -39,6 +39,7 @@ module.exports = async (ctx) => {
config.cache.routeExpire,
false
);
const name = containerData.data.userInfo.screen_name;
const description = containerData.data.userInfo.description;
const profileImageUrl = containerData.data.userInfo.profile_image_url;
@ -54,6 +55,7 @@ module.exports = async (ctx) => {
Referer: `https://m.weibo.cn/u/${uid}`,
'MWeibo-Pwa': 1,
'X-Requested-With': 'XMLHttpRequest',
Cookie: config.weibo.cookies,
},
});
return _r.data.data.cards;

View File

@ -1479,8 +1479,14 @@ YouTube provides official RSS feeds for channels, for instance [https://www.yout
### 博主 {#wei-bo-bo-zhu}
<Route author="DIYgod iplusx Rongronggg9" example="/weibo/user/1195230310" path="/weibo/user/:uid/:routeParams?" paramsDesc={['用户 id, 博主主页打开控制台执行 `$CONFIG.oid` 获取', '额外参数;请参阅上面的说明和表格;特别地,当 `routeParams=1` 时开启微博视频显示']} radar="1">
部分博主仅登录可见,不支持订阅,可以通过打开 `https://m.weibo.cn/u/:uid` 验证
<Route author="DIYgod iplusx Rongronggg9" example="/weibo/user/1195230310" path="/weibo/user/:uid/:routeParams?" paramsDesc={['用户 id, 博主主页打开控制台执行 `$CONFIG.oid` 获取', '额外参数;请参阅上面的说明和表格;特别地,当 `routeParams=1` 时开启微博视频显示']} radar="1" anticrawler="1">
:::warning
部分博主仅登录可见,未提供 Cookie 的情况下不支持订阅,可以通过打开 `https://m.weibo.cn/u/:uid` 验证。如需要订阅该部分博主,可配置 Cookie 后订阅。
未提供 Cookie 的情况下偶尔会触发反爬限制,提供 Cookie 可缓解该情况。
微博用户 Cookie 的配置可参照部署文档
:::
</Route>
### 关键词 {#wei-bo-guan-jian-ci}