Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(route): Optimize Weibo blogger routing | 优化微博博主路由 #14365

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/v2/weibo/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -32,13 +31,15 @@ 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;
},
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;
Expand All @@ -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;
Expand Down
10 changes: 8 additions & 2 deletions website/docs/routes/social-media.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Loading