mirror of
https://github.com/imsyy/DailyHotApi.git
synced 2026-01-12 13:14:55 +08:00
@@ -42,12 +42,14 @@ export type RouterType = {
|
||||
bilibili: {
|
||||
bvid: string;
|
||||
title: string;
|
||||
desc: string;
|
||||
pic: string;
|
||||
owner: {
|
||||
desc?: string;
|
||||
pic?: string;
|
||||
author?: string;
|
||||
video_review?: number;
|
||||
owner?: {
|
||||
name: string;
|
||||
};
|
||||
stat: {
|
||||
stat?: {
|
||||
view: number;
|
||||
};
|
||||
short_link_v2?: string;
|
||||
|
||||
@@ -53,6 +53,8 @@ const getList = async (options: Options, noCache: boolean) => {
|
||||
},
|
||||
noCache,
|
||||
});
|
||||
// 是否触发风控
|
||||
if (result.data?.data?.list?.length > 0) {
|
||||
const list = result.data.data.list;
|
||||
return {
|
||||
fromCache: result.fromCache,
|
||||
@@ -60,7 +62,7 @@ const getList = async (options: Options, noCache: boolean) => {
|
||||
data: list.map((v: RouterType["bilibili"]) => ({
|
||||
id: v.bvid,
|
||||
title: v.title,
|
||||
desc: v.desc,
|
||||
desc: v.desc || "该视频暂无简介",
|
||||
cover: v.pic.replace(/http:/, "https:"),
|
||||
author: v.owner.name,
|
||||
hot: v.stat.view,
|
||||
@@ -68,4 +70,33 @@ const getList = async (options: Options, noCache: boolean) => {
|
||||
mobileUrl: `https://m.bilibili.com/video/${v.bvid}`,
|
||||
})),
|
||||
};
|
||||
}
|
||||
// 采用备用接口
|
||||
else {
|
||||
const url = `https://api.bilibili.com/x/web-interface/ranking?jsonp=jsonp?rid=${type}&type=1&callback=__jp0`;
|
||||
const result = await get({
|
||||
url,
|
||||
headers: {
|
||||
Referer: `https://www.bilibili.com/ranking/all`,
|
||||
"User-Agent":
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
|
||||
},
|
||||
noCache,
|
||||
});
|
||||
const list = result.data.data.list;
|
||||
return {
|
||||
fromCache: result.fromCache,
|
||||
updateTime: result.updateTime,
|
||||
data: list.map((v: RouterType["bilibili"]) => ({
|
||||
id: v.bvid,
|
||||
title: v.title,
|
||||
desc: v.desc || "该视频暂无简介",
|
||||
cover: v.pic.replace(/http:/, "https:"),
|
||||
author: v.author,
|
||||
hot: v.video_review,
|
||||
url: `https://www.bilibili.com/video/${v.bvid}`,
|
||||
mobileUrl: `https://m.bilibili.com/video/${v.bvid}`,
|
||||
})),
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user