feat(route): bilibili 动态路由新增:将话题作为 category (#15741)
This commit is contained in:
@@ -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('<br>')
|
||||
);
|
||||
}
|
||||
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,
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user