mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-03-13 10:30:18 +08:00
fix(route/bilibili/weekly): await all async items before storing in cache (#21365)
This commit is contained in:
@@ -51,23 +51,25 @@ async function handler(ctx) {
|
||||
title: 'B站每周必看',
|
||||
link: 'https://www.bilibili.com/h5/weekly-recommend',
|
||||
description: 'B站每周必看',
|
||||
item: data.map(async (item) => {
|
||||
const subtitles = isJsonFeed && !config.bilibili.excludeSubtitles && item.bvid ? await cache.getVideoSubtitleAttachment(item.bvid) : [];
|
||||
return {
|
||||
title: item.title,
|
||||
description: utils.renderUGCDescription(embed, item.cover, `${weekly_name} ${item.title} - ${item.rcmd_reason}`, item.param, undefined, item.bvid),
|
||||
link: weekly_number > 60 && item.bvid ? `https://www.bilibili.com/video/${item.bvid}` : `https://www.bilibili.com/video/av${item.param}`,
|
||||
attachments: item.bvid
|
||||
? [
|
||||
{
|
||||
url: getVideoUrl(item.bvid),
|
||||
mime_type: 'text/html',
|
||||
duration_in_seconds: parseDuration(item.cover_right_text_1),
|
||||
},
|
||||
...subtitles,
|
||||
]
|
||||
: undefined,
|
||||
};
|
||||
}),
|
||||
item: await Promise.all(
|
||||
data.map(async (item) => {
|
||||
const subtitles = isJsonFeed && !config.bilibili.excludeSubtitles && item.bvid ? await cache.getVideoSubtitleAttachment(item.bvid) : [];
|
||||
return {
|
||||
title: item.title,
|
||||
description: utils.renderUGCDescription(embed, item.cover, `${weekly_name} ${item.title} - ${item.rcmd_reason}`, item.param, undefined, item.bvid),
|
||||
link: weekly_number > 60 && item.bvid ? `https://www.bilibili.com/video/${item.bvid}` : `https://www.bilibili.com/video/av${item.param}`,
|
||||
attachments: item.bvid
|
||||
? [
|
||||
{
|
||||
url: getVideoUrl(item.bvid),
|
||||
mime_type: 'text/html',
|
||||
duration_in_seconds: parseDuration(item.cover_right_text_1),
|
||||
},
|
||||
...subtitles,
|
||||
]
|
||||
: undefined,
|
||||
};
|
||||
})
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user