diff --git a/server/sources/bilibili.ts b/server/sources/bilibili.ts index 57c4f32..40a678f 100644 --- a/server/sources/bilibili.ts +++ b/server/sources/bilibili.ts @@ -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, }) diff --git a/shared/pinyin.json b/shared/pinyin.json index ae1032b..b85ff68 100644 --- a/shared/pinyin.json +++ b/shared/pinyin.json @@ -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", diff --git a/shared/pre-sources.ts b/shared/pre-sources.ts index 4fe4530..99bf030 100644 --- a/shared/pre-sources.ts +++ b/shared/pre-sources.ts @@ -276,6 +276,12 @@ export const originSources = { column: "china", type: "hottest", }, + "ranking": { + title: "排行榜", + column: "china", + type: "hottest", + interval: Time.Common, + }, }, }, "kuaishou": { diff --git a/shared/sources.json b/shared/sources.json index d5ad0ec..84cb40c 100644 --- a/shared/sources.json +++ b/shared/sources.json @@ -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",