fix(source): mktnews
This commit is contained in:
@@ -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}`,
|
||||
}))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user