mirror of
https://gh-proxy.org/https://github.com/tiajinsha/JKVideo
synced 2026-07-07 23:18:38 +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 items: any[] = res.data.data?.item ?? [];
|
||||
return items.map(item => ({
|
||||
return items
|
||||
.map(item => ({
|
||||
...item,
|
||||
aid: item.id ?? item.aid,
|
||||
pic: item.pic ?? item.cover,
|
||||
owner: item.owner ?? { mid: 0, name: item.owner_info?.name ?? '', face: item.owner_info?.face ?? '' },
|
||||
})) as VideoItem[];
|
||||
}))
|
||||
.filter((item: any) => item.bvid && (item.pic || item.cover) && item.duration > 0) as VideoItem[];
|
||||
}
|
||||
|
||||
export async function getPopularVideos(pn = 1): Promise<VideoItem[]> {
|
||||
|
||||
Reference in New Issue
Block a user