newsnow/server/sources/toutiao.ts
2024-10-21 01:38:58 +08:00

24 lines
483 B
TypeScript

interface Res {
data: {
ClusterIdStr: string
Title: string
HotValue: string
Image: {
url: string
}
}[]
}
export default defineSource(async () => {
const url = "https://www.toutiao.com/hot-event/hot-board/?origin=toutiao_pc"
const res: Res = await $fetch(url)
return res.data
.map((k) => {
return {
id: k.ClusterIdStr,
title: k.Title,
url: `https://www.toutiao.com/trending/${k.ClusterIdStr}/`,
}
})
})