From 0b0075e819ea9ace44e8c9cd2c2f2c975cda5477 Mon Sep 17 00:00:00 2001 From: Brent Vollebregt Date: Sat, 18 May 2024 12:08:04 +1200 Subject: [PATCH] Stop logging Genius 404s --- src/api/genius.ts | 29 ++++++++++++++++++++++++++--- src/api/lrclib.ts | 4 +++- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/api/genius.ts b/src/api/genius.ts index 718511a..5277d6c 100644 --- a/src/api/genius.ts +++ b/src/api/genius.ts @@ -151,7 +151,13 @@ export const getLyricsForPath = async (geniusPath: string): Promise(requestUrl); + const response = await axios.get(requestUrl, { + validateStatus: status => status === 200 || status === 404 + }); + + if (response.status === 404) { + return null; + } const html = response.data; const $ = cheerio.load(html); // Load in the page @@ -171,8 +177,25 @@ export const getLyricsForPath = async (geniusPath: string): Promise