feat: add bilibili video ranking

This commit is contained in:
Ou
2025-04-07 00:46:15 +08:00
parent a1fe7df520
commit 13e300ccbc
4 changed files with 34 additions and 0 deletions
+18
View File
@@ -119,6 +119,23 @@ const hotVideo = defineSource(async () => {
}))
})
const ranking = defineSource(async () => {
const url = "https://api.bilibili.com/x/web-interface/ranking/v2"
const res: HotVideoRes = await myFetch(url)
return res.data.list.map(video => ({
id: video.bvid,
title: video.title,
url: `https://www.bilibili.com/video/${video.bvid}`,
pubDate: video.pubdate * 1000,
extra: {
info: `${video.owner.name} · ${formatNumber(video.stat.view)}观看 · ${formatNumber(video.stat.like)}点赞`,
hover: video.desc,
icon: proxyPicture(video.pic),
},
}))
})
function formatNumber(num: number): string {
if (num >= 10000) {
return `${Math.floor(num / 10000)}w+`
@@ -130,4 +147,5 @@ export default defineSource({
"bilibili": hotSearch,
"bilibili-hot-search": hotSearch,
"bilibili-hot-video": hotVideo,
"bilibili-ranking": ranking,
})
+1
View File
@@ -30,6 +30,7 @@
"github-trending-today": "Github-Today",
"bilibili-hot-search": "bilibili-resou",
"bilibili-hot-video": "bilibili-remenshipin",
"bilibili-ranking": "bilibili-paixingbang",
"kuaishou": "kuaishou",
"kaopu": "kaopuxinwen",
"jin10": "jinshishuju",
+6
View File
@@ -276,6 +276,12 @@ export const originSources = {
column: "china",
type: "hottest",
},
"ranking": {
title: "排行榜",
column: "china",
type: "hottest",
interval: Time.Common,
},
},
},
"kuaishou": {
+9
View File
@@ -354,6 +354,15 @@
"interval": 600000,
"title": "热门视频"
},
"bilibili-ranking": {
"name": "哔哩哔哩",
"type": "hottest",
"column": "china",
"home": "https://www.bilibili.com",
"color": "blue",
"interval": 1800000,
"title": "排行榜"
},
"kuaishou": {
"name": "快手",
"type": "hottest",