mirror of
https://gh-proxy.org/https://github.com/tiajinsha/JKVideo
synced 2026-07-08 23:43:52 +08:00
fix: filter out ad/live/invalid cards from recommend feed
推荐流中混入广告、直播等特殊条目,缺少 pic/duration/bvid 字段, 导致页面出现空白卡片。过滤掉不满足条件的条目。
This commit is contained in:
@@ -76,12 +76,14 @@ export async function getRecommendFeed(freshIdx = 0): Promise<VideoItem[]> {
|
|||||||
);
|
);
|
||||||
const res = await api.get('/x/web-interface/wbi/index/top/feed/rcmd', { params: signed });
|
const res = await api.get('/x/web-interface/wbi/index/top/feed/rcmd', { params: signed });
|
||||||
const items: any[] = res.data.data?.item ?? [];
|
const items: any[] = res.data.data?.item ?? [];
|
||||||
return items.map(item => ({
|
return items
|
||||||
...item,
|
.map(item => ({
|
||||||
aid: item.id ?? item.aid,
|
...item,
|
||||||
pic: item.pic ?? item.cover,
|
aid: item.id ?? item.aid,
|
||||||
owner: item.owner ?? { mid: 0, name: item.owner_info?.name ?? '', face: item.owner_info?.face ?? '' },
|
pic: item.pic ?? item.cover,
|
||||||
})) as VideoItem[];
|
owner: item.owner ?? { mid: 0, name: item.owner_info?.name ?? '', face: item.owner_info?.face ?? '' },
|
||||||
|
}))
|
||||||
|
.filter((item: any) => item.bvid && (item.pic || item.cover) && item.duration > 0) as VideoItem[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getPopularVideos(pn = 1): Promise<VideoItem[]> {
|
export async function getPopularVideos(pn = 1): Promise<VideoItem[]> {
|
||||||
|
|||||||
Reference in New Issue
Block a user