From 5ea6b7a7246759b99a6aaad077d26159ef06e344 Mon Sep 17 00:00:00 2001 From: Andvari <31068367+dzx-dzx@users.noreply.github.com> Date: Wed, 3 Dec 2025 22:59:47 +0800 Subject: [PATCH] fix(route/huxiu): Replace API endpoint for `moment` route (#20388) --- lib/routes/huxiu/moment.ts | 4 ++-- lib/routes/huxiu/util.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/routes/huxiu/moment.ts b/lib/routes/huxiu/moment.ts index c5a75767f..d7b998248 100644 --- a/lib/routes/huxiu/moment.ts +++ b/lib/routes/huxiu/moment.ts @@ -31,7 +31,7 @@ export const route: Route = { async function handler(ctx) { const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 20; - const apiUrl = new URL('web-v2/moment/feed', apiMomentRootUrl).href; + const apiUrl = new URL('web-v3/moment/feed', apiMomentRootUrl).href; const currentUrl = new URL('moment', rootUrl).href; const { data: response } = await got.post(apiUrl, { @@ -40,7 +40,7 @@ async function handler(ctx) { }, }); - const items = await processItems(response.data.moment_list.datalist[0].datalist, limit, cache.tryGet); + const items = await processItems(response.data.moment_list.datalist, limit, cache.tryGet); const data = await fetchData(currentUrl); diff --git a/lib/routes/huxiu/util.ts b/lib/routes/huxiu/util.ts index 6eebcfe43..d07a2ee80 100644 --- a/lib/routes/huxiu/util.ts +++ b/lib/routes/huxiu/util.ts @@ -336,9 +336,9 @@ const processItems = async (items, limit, tryGet) => { let guid = ''; let link = ''; - if (item.moment_id) { - guid = `huxiu-moment-${item.moment_id}`; - link = item.url || new URL(`moment/${item.moment_id}.html`, rootUrl).href; + if (item.object_type === 8) { + guid = `huxiu-moment-${item.object_id}`; + link = item.url || new URL(`moment/${item.object_id}.html`, rootUrl).href; } else if (item.brief_id || /huxiu\.com\/brief\//.test(item.url)) { item.brief_id = item.brief_id ?? item.aid; guid = `huxiu-brief-${item.brief_id}`;