From 58ea4aed01383ead74d5e32e75335eddc2f015be Mon Sep 17 00:00:00 2001 From: wukko Date: Wed, 9 Jul 2025 15:56:22 +0600 Subject: [PATCH] api/soundcloud: check if a cover url returns 200 some songs don't have a cover but artwork_url is still defined, even though the response is always 404 --- api/src/processing/services/soundcloud.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/api/src/processing/services/soundcloud.js b/api/src/processing/services/soundcloud.js index 1c04a366..a73e6474 100644 --- a/api/src/processing/services/soundcloud.js +++ b/api/src/processing/services/soundcloud.js @@ -148,7 +148,14 @@ export default async function(obj) { let cover; if (json.artwork_url) { - cover = json.artwork_url.replace(/-large/, "-t1080x1080"); + const coverUrl = json.artwork_url.replace(/-large/, "-t1080x1080"); + const testCover = await fetch(coverUrl) + .then(r => r.status === 200) + .catch(() => {}); + + if (testCover) { + cover = coverUrl; + } } return {