diff --git a/lib/routes/bilibili/dynamic.ts b/lib/routes/bilibili/dynamic.ts
index ebffeb182..21ff08267 100644
--- a/lib/routes/bilibili/dynamic.ts
+++ b/lib/routes/bilibili/dynamic.ts
@@ -61,12 +61,16 @@ const getTitle = (data: Modules) => {
if (!major) {
return '';
}
- if (major.type === 'MAJOR_TYPE_NONE') {
- return major.none?.tips;
+ if (major.none) {
+ return major.none.tips;
}
- if (major.type === 'MAJOR_TYPE_COURSES') {
+ if (major.courses) {
return `${major.courses?.title} - ${major.courses?.sub_title}`;
}
+ if (major.live_rcmd?.content) {
+ // 正在直播的动态
+ return JSON.parse(major.live_rcmd.content)?.live_play_info?.title;
+ }
const type = major.type.replace('MAJOR_TYPE_', '').toLowerCase();
return major[type]?.title;
};
@@ -85,10 +89,15 @@ const getDes = (data: Modules) => {
desc += desc ? `
//转发自: ${major.common.desc}` : major.common.desc;
return desc;
}
- // 直播动态
+ // 转发的直播间
if (major?.live) {
return `${major.live?.desc_first}
${major.live?.desc_second}`;
}
+ // 正在直播的动态
+ if (major.live_rcmd?.content) {
+ const live_play_info = JSON.parse(major.live_rcmd.content)?.live_play_info;
+ return `${live_play_info?.area_name}·${live_play_info?.watched_show?.text_large}`;
+ }
// 图文动态
if (major?.opus) {
return major?.opus?.summary?.text;
@@ -130,6 +139,10 @@ const getImgs = (data: Modules) => {
if (major.draw?.items?.length) {
imgUrls.push(...major.draw.items.map((e) => e.src));
}
+ // 正在直播的动态
+ if (major.live_rcmd?.content) {
+ imgUrls.push(JSON.parse(major.live_rcmd.content)?.live_play_info?.cover);
+ }
const type = major.type.replace('MAJOR_TYPE_', '').toLowerCase();
if (major[type]?.cover) {
imgUrls.push(major[type].cover);
@@ -195,6 +208,12 @@ const getUrl = (item?: Item2, useAvid = false) => {
url = `https://live.bilibili.com/${major?.live?.id}`;
text = `
直播间地址:${url}`;
break;
+ case 'MAJOR_TYPE_LIVE_RCMD': {
+ const live_play_info = JSON.parse(major.live_rcmd?.content || '{}')?.live_play_info;
+ url = `https://live.bilibili.com/${live_play_info?.room_id}`;
+ text = `
直播间地址:${url}`;
+ break;
+ }
default:
return null;
}
@@ -271,6 +290,7 @@ async function handler(ctx) {
// emoji
let description = getDes(data) || '';
+ const title = getTitle(data) || description;
// 换行处理
description = description.replaceAll('\r\n', '
').replaceAll('\n', '
');
if (data.module_dynamic?.desc?.rich_text_nodes?.length && showEmoji) {
@@ -325,7 +345,7 @@ async function handler(ctx) {
}
const imgHTMLSource = imgHTML ? `
${imgHTML}` : '';
return {
- title: getTitle(data) || description,
+ title,
description: `${description}${originDescription}
${urlText}${getIframe(data, disableEmbed)}${getIframe(origin, disableEmbed)}${imgHTMLSource}`,
pubDate: data.module_author?.pub_ts ? parseDate(data.module_author.pub_ts, 'X') : undefined,
link,