fix(route): normalize Bilibili mall image URLs

This commit is contained in:
DIYgod
2026-05-14 13:18:46 +08:00
parent 591dcb85be
commit 265921b7b8
+3 -1
View File
@@ -1,6 +1,8 @@
import type { Route } from '@/types';
import got from '@/utils/got';
const resolveImageUrl = (imageUrl: string) => (imageUrl.startsWith('//') ? `https:${imageUrl}` : imageUrl);
export const route: Route = {
path: '/mall/new/:category?',
categories: ['social-media'],
@@ -46,7 +48,7 @@ async function handler(ctx) {
link: 'https://mall.bilibili.com/newdate.html?noTitleBar=1&page=new&from=new_product&loadingShow=1',
item: items.map((item) => ({
title: item.name,
description: `${item.name}<br>${item.priceDesc ? `${item.pricePrefix}${item.priceSymbol}${item.priceDesc[0]}` : ''}<br><img src="https:${item.img}"><br><a href="${item.itemUrl}">APP 内打开</a>`,
description: `${item.name}<br>${item.priceDesc ? `${item.pricePrefix}${item.priceSymbol}${item.priceDesc[0]}` : ''}<br><img src="${resolveImageUrl(item.img)}"><br><a href="${item.itemUrl}">APP 内打开</a>`,
link: item.itemUrlForH5,
})),
};