fix(route/huxiu): Replace API endpoint for moment route (#20388)

This commit is contained in:
Andvari
2025-12-03 22:59:47 +08:00
committed by GitHub
parent 81b0d3ef9d
commit 5ea6b7a724
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -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);
+3 -3
View File
@@ -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}`;