39 lines
884 B
TypeScript
Raw Normal View History

2024-10-08 22:44:42 +08:00
interface Res {
data: {
card_label?: {
icon: string
night_icon: string
}
target: {
id: number
title: string
url: string
created: number
answer_count: number
follower_count: number
bound_topic_ids: number[]
comment_count: number
is_following: boolean
excerpt: string
}
}[]
}
2024-10-25 03:06:03 +08:00
export default defineSource({
zhihu: async () => {
const url = "https://www.zhihu.com/api/v3/feed/topstory/hot-lists/total?limit=20&desktop=true"
const res: Res = await myFetch(url)
2024-10-25 03:06:03 +08:00
return res.data
.map((k) => {
return {
id: k.target.id,
title: k.target.title,
extra: {
2024-10-31 14:21:11 +08:00
icon: k.card_label?.night_icon && proxyPicture(k.card_label.night_icon),
2024-10-25 03:06:03 +08:00
},
url: `https://www.zhihu.com/question/${k.target.id}`,
}
})
},
2024-10-08 22:44:42 +08:00
})