From c8f182dc4c5278f0e272a669cef4ad4f26f7db9d Mon Sep 17 00:00:00 2001 From: Andvari <31068367+dzx-dzx@users.noreply.github.com> Date: Thu, 7 Nov 2024 23:23:21 +0800 Subject: [PATCH] fix(route/caixin): filter out articles that does not have ID (#17495) --- lib/routes/caixin/utils-fulltext.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/routes/caixin/utils-fulltext.ts b/lib/routes/caixin/utils-fulltext.ts index dd41e12a36eece..1a8289049dda18 100644 --- a/lib/routes/caixin/utils-fulltext.ts +++ b/lib/routes/caixin/utils-fulltext.ts @@ -12,6 +12,10 @@ export async function getFulltext(url: string) { if (!config.caixin.cookie) { return; } + if (!/(\d+)\.html/.test(url)) { + return; + } + const articleID = url.match(/(\d+)\.html/)[1]; const nonce = crypto.randomUUID().replaceAll('-', '').toUpperCase(); @@ -20,7 +24,6 @@ export async function getFulltext(url: string) { .find((e) => e.includes('SA_USER_UID')) ?.split('=')[1]; // - const articleID = url.match(/(\d+)\.html/)[1]; const rawString = `id=${articleID}&uid=${userID}&${nonce}=nonce`; const sig = new KJUR.crypto.Signature({ alg: 'SHA256withRSA' });