From ab3359164d77acacfdbbac5c75586a03ee9eeeb3 Mon Sep 17 00:00:00 2001 From: huanfei <41602338+huanfe1@users.noreply.github.com> Date: Wed, 18 Sep 2024 21:07:13 +0800 Subject: [PATCH] fix: Tencent news can't fetch non-digital users (#16798) * fix: Unable to fetch non-digital users * fix: add type variable * fix: add semicolons --- lib/routes/tencent/news/author.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/routes/tencent/news/author.ts b/lib/routes/tencent/news/author.ts index bb1169b4d..f100474fd 100644 --- a/lib/routes/tencent/news/author.ts +++ b/lib/routes/tencent/news/author.ts @@ -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;