From b668a139beec34aa6491336655a0f49642ff324f Mon Sep 17 00:00:00 2001 From: vitalets Date: Tue, 21 Jan 2025 15:55:49 +0400 Subject: [PATCH] fix parsing undefined for 429 --- src/helpers.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/helpers.ts b/src/helpers.ts index 34f08afa..fff5ac2e 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -1,6 +1,6 @@ -export function extractTooManyRequestsInfo(html: string) { - const ip = html.match(/IP address: (.+?)
/)?.[1] || ''; - const time = html.match(/Time: (.+?)
/)?.[1] || ''; - const url = (html.match(/URL: (.+?)
/)?.[1] || '').replace(/&/g, '&'); +export function extractTooManyRequestsInfo(html: string | undefined) { + const ip = html?.match(/IP address: (.+?)
/)?.[1] || ''; + const time = html?.match(/Time: (.+?)
/)?.[1] || ''; + const url = (html?.match(/URL: (.+?)
/)?.[1] || '').replace(/&/g, '&'); return { ip, time, url }; }