diff --git a/lib/routes/weibo/utils.ts b/lib/routes/weibo/utils.ts index 4efa0a31e..7d86af49d 100644 --- a/lib/routes/weibo/utils.ts +++ b/lib/routes/weibo/utils.ts @@ -74,6 +74,10 @@ const weiboUtils = { if (!showLinkIconInDescription) { htmlNewLineUnreplaced = htmlNewLineUnreplaced.replaceAll(/(]*>)]*><\/span>[^<>]*?([^<>]*?)<\/span><\/a>/g, '$1$2'); } + + // 提取 话题作为 category + const category: string[] = htmlNewLineUnreplaced.match(/#([^<>]*?)#<\/span>/g)?.map((e) => e?.match(/#([^#]+)#/)?.[1]); + // 去掉乱七八糟的图标 // 不需要,上述的替换应该已经把所有的图标都替换掉了,且这条 regex 会破坏上述替换不发生时的输出 // htmlNewLineUnreplaced = htmlNewLineUnreplaced.replace(/(]*?>)<\/span>/g, ''); // 将行内图标的高度设置为一行,改善阅读体验。但有些阅读器删除了 style 属性,无法生效 // 不需要,微博已经作此设置 @@ -241,7 +245,7 @@ const weiboUtils = { const author = status.user?.screen_name; const pubDate = status.created_at; - return { description: html, title, link, guid, author, pubDate }; + return { description: html, title, link, guid, author, pubDate, category }; }, getShowData: async (uid, bid) => { const link = `https://m.weibo.cn/statuses/show?id=${bid}`;