Skip to content

Commit 3b845ce

Browse files
committed
fix(source): mktnews
1 parent a0941ef commit 3b845ce

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

server/sources/mktnews.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,21 @@ const flash = defineSource(async () => {
4141
const typeMap = { policy: "Policy", AI: "AI", financial: "Financial" } as const
4242

4343
const allReports = categories.flatMap((category) => {
44-
const flash_list = res.data.find(item => item.name === category)?.child[0]?.flash_list || []
45-
return flash_list.map(item => ({ ...item, type: typeMap[category] }))
44+
const categoryData = res.data.find(item => item.name === category)
45+
if (!categoryData?.child) return []
46+
47+
return categoryData.child.flatMap(subCategory =>
48+
(subCategory.flash_list || []).map(item => ({ ...item, type: typeMap[category] })),
49+
)
4650
})
4751

4852
return allReports
4953
.sort((a, b) => b.time.localeCompare(a.time))
5054
.map(item => ({
5155
id: item.id,
52-
title: item.data.title || item.data.content,
56+
title: item.data.title || item.data.content.match(/^([^]*)(.*)$/)?.[1] || item.data.content,
5357
pubDate: item.time,
54-
extra: { info: item.type },
58+
extra: { info: item.type, hover: item.data.content },
5559
url: `https://mktnews.net/flashDetail.html?id=${item.id}`,
5660
}))
5761
})

0 commit comments

Comments
 (0)