From 9856a2a2fc321dfae22799351a7dbfe6e65b7083 Mon Sep 17 00:00:00 2001 From: Ethan Shen <42264778+nczitzk@users.noreply.github.com> Date: Thu, 7 Nov 2024 00:14:20 +0800 Subject: [PATCH] =?UTF-8?q?fix(route):=20=E5=8D=8E=E4=B8=AD=E7=A7=91?= =?UTF-8?q?=E6=8A=80=E5=A4=A7=E5=AD=A6=E7=A0=94=E7=A9=B6=E7=94=9F=E9=99=A2?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E4=B8=8D=E5=AE=8C=E6=95=B4=20(#17478)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/routes/hust/gs.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/routes/hust/gs.ts b/lib/routes/hust/gs.ts index 1f3eb6a77..2339b4790 100644 --- a/lib/routes/hust/gs.ts +++ b/lib/routes/hust/gs.ts @@ -57,11 +57,12 @@ export const handler = async (ctx) => { ) ); - const image = new URL($('div.logo img').prop('content'), rootUrl).href; + const title = $('meta[name="keywords"]').prop('content')?.replace(/,/g, ' - ') ?? $('title').text(); + const image = new URL($('div.logo img').prop('src'), rootUrl).href; return { - title: $('title').text(), - description: $('META[Name="keywords"]').prop('Content'), + title, + description: title.split(/-/).pop()?.trim(), link: currentUrl, item: items, allowEmpty: true,