From 3b845ce6b5c115792b3d2f83aa15824b6539fa53 Mon Sep 17 00:00:00 2001 From: ourongxing Date: Mon, 27 Oct 2025 16:14:01 +0000 Subject: [PATCH] fix(source): mktnews --- server/sources/mktnews.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/server/sources/mktnews.ts b/server/sources/mktnews.ts index 148489e..b8034df 100644 --- a/server/sources/mktnews.ts +++ b/server/sources/mktnews.ts @@ -41,17 +41,21 @@ const flash = defineSource(async () => { const typeMap = { policy: "Policy", AI: "AI", financial: "Financial" } as const const allReports = categories.flatMap((category) => { - const flash_list = res.data.find(item => item.name === category)?.child[0]?.flash_list || [] - return flash_list.map(item => ({ ...item, type: typeMap[category] })) + const categoryData = res.data.find(item => item.name === category) + if (!categoryData?.child) return [] + + return categoryData.child.flatMap(subCategory => + (subCategory.flash_list || []).map(item => ({ ...item, type: typeMap[category] })), + ) }) return allReports .sort((a, b) => b.time.localeCompare(a.time)) .map(item => ({ id: item.id, - title: item.data.title || item.data.content, + title: item.data.title || item.data.content.match(/^【([^】]*)】(.*)$/)?.[1] || item.data.content, pubDate: item.time, - extra: { info: item.type }, + extra: { info: item.type, hover: item.data.content }, url: `https://mktnews.net/flashDetail.html?id=${item.id}`, })) })