diff --git a/lib/routes/bilibili/cache.js b/lib/routes/bilibili/cache.js
index d2fe80200..8693fffc9 100644
--- a/lib/routes/bilibili/cache.js
+++ b/lib/routes/bilibili/cache.js
@@ -74,33 +74,6 @@ module.exports = {
}
return name;
},
- getFavNameFromFid: async (ctx, fid, uid) => {
- const key = `bili-favName-from-fid-${fid}`;
- let name = await ctx.cache.get(key);
-
- if (!name) {
- const nameResponse = await got({
- method: 'get',
- url: `https://api.bilibili.com/x/space/fav/nav?mid=${uid}`,
- headers: {
- Referer: `https://space.bilibili.com/${uid}/#/favlist`,
- },
- });
- if (nameResponse && nameResponse.data && nameResponse.data.data && nameResponse.data.data.archive) {
- nameResponse.data.data.archive.forEach((item) => {
- // noinspection EqualityComparisonWithCoercionJS
- if (fid === item.fid.toString()) {
- name = item.name;
- }
- });
- }
- ctx.cache.set(key, name);
- }
- if (!name) {
- name = 'Unknown';
- }
- return name;
- },
getCidFromAid: async (ctx, aid, pid) => {
const key = `bili-Cid-from-Aid-${aid}-${pid}`;
let cid = await ctx.cache.get(key);
diff --git a/lib/routes/bilibili/fav.js b/lib/routes/bilibili/fav.js
index 5e4d5adb5..af7b02bc0 100644
--- a/lib/routes/bilibili/fav.js
+++ b/lib/routes/bilibili/fav.js
@@ -1,5 +1,4 @@
const got = require('@/utils/got');
-const cache = require('./cache');
module.exports = async (ctx) => {
const fid = ctx.params.fid;
@@ -7,14 +6,14 @@ module.exports = async (ctx) => {
const response = await got({
method: 'get',
- url: `https://api.bilibili.com/x/v2/fav/video?vmid=${uid}&fid=${fid}`,
+ url: `https://api.bilibili.com/medialist/gateway/base/spaceDetail?media_id=${fid}&pn=1&ps=20&keyword=&order=mtime&type=0&tid=0`,
headers: {
Referer: `https://space.bilibili.com/${uid}/`,
},
});
const data = response.data.data;
- const userName = await cache.getUsernameFromUID(ctx, uid);
- const favName = await cache.getFavNameFromFid(ctx, fid, uid);
+ const userName = data.info.upper.name;
+ const favName = data.info.title;
ctx.state.data = {
title: `${userName} 的 bilibili 收藏夹 ${favName}`,
@@ -23,12 +22,12 @@ module.exports = async (ctx) => {
item:
data &&
- data.archives &&
- data.archives.map((item) => ({
+ data.medias &&
+ data.medias.map((item) => ({
title: item.title,
- description: `${item.desc}
`,
- pubDate: new Date(item.fav_at * 1000).toUTCString(),
- link: `https://www.bilibili.com/video/av${item.aid}`,
+ description: `${item.intro}`,
+ pubDate: new Date(item.fav_time * 1000).toUTCString(),
+ link: `https://www.bilibili.com/${item.link.replace('bilibili://video/', 'video/av')}`,
})),
};
};