diff --git a/lib/routes/bilibili/dynamic.ts b/lib/routes/bilibili/dynamic.ts index 8ec42a6ed..30f056cc1 100644 --- a/lib/routes/bilibili/dynamic.ts +++ b/lib/routes/bilibili/dynamic.ts @@ -275,7 +275,7 @@ async function handler(ctx) { let description = getDes(data) || ''; const title = getTitle(data) || description; // 没有 title 的时候使用 desc 填充 - + const category: string[] = []; // emoji if (data.module_dynamic?.desc?.rich_text_nodes?.length) { const nodes = data.module_dynamic.desc.rich_text_nodes; @@ -301,6 +301,20 @@ async function handler(ctx) { .join('
') ); } + if (node?.type === 'RICH_TEXT_NODE_TYPE_TOPIC') { + // 将话题作为 category + category.push(node.text.match(/#(\S+)#/)?.[1] || ''); + } + } + } + + if (data.module_dynamic?.major?.opus?.summary?.rich_text_nodes?.length) { + const nodes = data.module_dynamic.major.opus.summary.rich_text_nodes; + for (const node of nodes) { + if (node?.type === 'RICH_TEXT_NODE_TYPE_TOPIC') { + // 将话题作为 category + category.push(node.text.match(/#(\S+)#/)?.[1] || ''); + } } } @@ -353,6 +367,7 @@ async function handler(ctx) { pubDate: data.module_author?.pub_ts ? parseDate(data.module_author.pub_ts, 'X') : undefined, link, author, + category: category.length ? category : undefined, }; }) );