fix: Tencent news can't fetch non-digital users (#16798)

* fix: Unable to fetch non-digital users

* fix: add type variable

* fix: add semicolons
This commit is contained in:
huanfei
2024-09-18 21:07:13 +08:00
committed by GitHub
parent c4b9af7e2d
commit ab3359164d
+2 -1
View File
@@ -35,7 +35,8 @@ export const route: Route = {
async function handler(ctx) {
const mid = ctx.req.param('mid');
const homePageInfoUrl = `https://i.news.qq.com/i/getUserHomepageInfo?chlid=${mid}`;
const userType = /^\d+$/.test(mid) ? "chlid" : "guestSuid";
const homePageInfoUrl = `https://i.news.qq.com/i/getUserHomepageInfo?${userType}=${mid}`;
const userInfo = await cache.tryGet(homePageInfoUrl, async () => (await got(homePageInfoUrl)).data.userinfo);
const title = userInfo.nick;
const description = userInfo.user_desc;