mirror of
https://github.com/ourongxing/newsnow.git
synced 2025-01-19 11:19:14 +08:00
27 lines
509 B
TypeScript
27 lines
509 B
TypeScript
|
interface Res {
|
||
|
data: {
|
||
|
bang_topic: {
|
||
|
topic_list: {
|
||
|
topic_id: string
|
||
|
topic_name: string
|
||
|
create_time: number
|
||
|
topic_url: string
|
||
|
|
||
|
}[]
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default defineSource(async () => {
|
||
|
const url = "https://tieba.baidu.com/hottopic/browse/topicList"
|
||
|
const res: Res = await $fetch(url)
|
||
|
return res.data.bang_topic.topic_list
|
||
|
.map((k) => {
|
||
|
return {
|
||
|
id: k.topic_id,
|
||
|
title: k.topic_name,
|
||
|
url: k.topic_url,
|
||
|
}
|
||
|
})
|
||
|
})
|