mirror of
https://github.com/ourongxing/newsnow.git
synced 2025-01-19 11:19:14 +08:00
fix: add bilibili wap api As a backup interface (#8)
Co-authored-by: Ou <orongxing@gmail.com>
This commit is contained in:
parent
77f1a887ea
commit
a29657033a
@ -1,35 +1,44 @@
|
|||||||
interface Res {
|
interface WapRes {
|
||||||
code: number
|
code: number
|
||||||
message: string
|
exp_str: string
|
||||||
ttl: number
|
|
||||||
data: {
|
|
||||||
trending: {
|
|
||||||
title: string
|
|
||||||
trackid: string
|
|
||||||
list: {
|
list: {
|
||||||
|
hot_id: number
|
||||||
keyword: string
|
keyword: string
|
||||||
show_name: string
|
show_name: string
|
||||||
|
score: number
|
||||||
|
word_type: number
|
||||||
|
goto_type: number
|
||||||
|
goto_value: string
|
||||||
icon: string
|
icon: string
|
||||||
uri: string
|
live_id: any[]
|
||||||
goto: string
|
call_reason: number
|
||||||
|
heat_layer: string
|
||||||
|
pos: number
|
||||||
|
id: number
|
||||||
|
status: string
|
||||||
|
name_type: string
|
||||||
|
resource_id: number
|
||||||
|
set_gray: number
|
||||||
|
card_values: any[]
|
||||||
heat_score: number
|
heat_score: number
|
||||||
|
stat_datas: {
|
||||||
|
etime: string
|
||||||
|
stime: string
|
||||||
|
is_commercial: string
|
||||||
|
}
|
||||||
}[]
|
}[]
|
||||||
}
|
top_list: any[]
|
||||||
}
|
hotword_egg_info: string
|
||||||
|
seid: string
|
||||||
|
timestamp: number
|
||||||
|
total_count: number
|
||||||
}
|
}
|
||||||
|
|
||||||
const hotSearch = defineSource(async () => {
|
const hotSearch = defineSource(async () => {
|
||||||
const url = "https://api.bilibili.com/x/web-interface/wbi/search/square?limit=30"
|
const url = "https://s.search.bilibili.com/main/hotword?limit=30"
|
||||||
const cookie = (await $fetch.raw(`https://bilibili.tv`)).headers.getSetCookie()
|
const res: WapRes = await $fetch(url)
|
||||||
const res: Res = await $fetch(url, {
|
|
||||||
headers: {
|
|
||||||
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",
|
|
||||||
"cookie": cookie[0].replace(/.tv/g, ".com"),
|
|
||||||
"referer": "https://www.bilibili.com/",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
return res.data.trending.list.map(k => ({
|
return res.list.map(k => ({
|
||||||
id: k.keyword,
|
id: k.keyword,
|
||||||
title: k.show_name,
|
title: k.show_name,
|
||||||
url: `https://search.bilibili.com/all?keyword=${encodeURIComponent(k.keyword)}`,
|
url: `https://search.bilibili.com/all?keyword=${encodeURIComponent(k.keyword)}`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user