fix(route): 修复 bilibili 动态路由 部分情况下缺失 title 的问题

This commit is contained in:
CaoMeiYouRen 2024-04-01 16:51:08 +08:00
parent d7f3e88ecf
commit df5b373e19
No known key found for this signature in database
GPG Key ID: C1281DB2FA902F23
1 changed files with 2 additions and 2 deletions

View File

@ -68,7 +68,7 @@ const getTitle = (data: Modules) => {
return `${major.courses?.title} - ${major.courses?.sub_title}`;
}
const type = major.type.replace('MAJOR_TYPE_', '').toLowerCase();
return major[type]?.title;
return major[type]?.title || getDes(data);
};
const getDes = (data: Modules) => {
let desc = '';
@ -325,7 +325,7 @@ async function handler(ctx) {
}
const imgHTMLSource = imgHTML ? `<br>${imgHTML}` : '';
return {
title: getTitle(data) || '',
title: getTitle(data),
description: `${description}${originDescription}<br>${urlText}${getIframe(data, disableEmbed)}${getIframe(origin, disableEmbed)}${imgHTMLSource}`,
pubDate: data.module_author?.pub_ts ? parseDate(data.module_author.pub_ts, 'X') : undefined,
link,