newsnow/server/sources/thepaper.ts

24 lines
545 B
TypeScript
Raw Permalink Normal View History

2024-10-21 17:00:51 +08:00
interface Res {
data: {
hotNews: {
contId: string
name: string
pubTimeLong: string
}[]
}
}
export default defineSource(async () => {
const url = "https://cache.thepaper.cn/contentapi/wwwIndex/rightSidebar"
const res: Res = await myFetch(url)
2024-10-21 17:00:51 +08:00
return res.data.hotNews
.map((k) => {
return {
id: k.contId,
title: k.name,
url: `https://www.thepaper.cn/newsDetail_forward_${k.contId}`,
mobileUrl: `https://m.thepaper.cn/newsDetail_forward_${k.contId}`,
}
})
})