diff --git a/lib/routes/bilibili/dynamic.ts b/lib/routes/bilibili/dynamic.ts index b5b21cf88..cd1ffb353 100644 --- a/lib/routes/bilibili/dynamic.ts +++ b/lib/routes/bilibili/dynamic.ts @@ -117,6 +117,7 @@ const getIframe = (data?: Modules, embed: boolean = true) => { if (aid === undefined && bvid === undefined) { return ''; } + // 不通过 utils.renderUGCDescription 渲染 img/description 以兼容其他格式的动态 return utils.renderUGCDescription(embed, '', '', aid, undefined, bvid); }; @@ -146,7 +147,10 @@ const getImgs = (data?: Modules) => { if (major[type]?.cover) { imgUrls.push(major[type].cover); } - return imgUrls.map((url) => ``).join(''); + return imgUrls + .filter(Boolean) + .map((url) => ``) + .join(''); }; const getUrl = (item?: Item2, useAvid = false) => { @@ -354,10 +358,9 @@ async function handler(ctx) { // 换行处理 description = description.replaceAll('\r\n', '
').replaceAll('\n', '
'); originDescription = originDescription.replaceAll('\r\n', '
').replaceAll('\n', '
'); - - const descriptions = [description, originDescription, urlText, originUrlText, getIframe(data, embed), getIframe(origin, embed), getImgs(data), getImgs(origin)] - .filter(Boolean) + const descriptions = [description, getIframe(data, embed), getImgs(data), urlText, originDescription, getIframe(origin, embed), getImgs(origin), originUrlText] .map((e) => e?.trim()) + .filter(Boolean) .join('
'); return { diff --git a/lib/routes/bilibili/templates/description.art b/lib/routes/bilibili/templates/description.art index 65e2261cf..5f6e5847d 100644 --- a/lib/routes/bilibili/templates/description.art +++ b/lib/routes/bilibili/templates/description.art @@ -7,6 +7,8 @@ {{ /if }}
{{ /if }} +{{ if img}}
+{{ /if }} {{@ description }}