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
This commit is contained in:
wukko 2025-07-09 15:56:22 +06:00
parent e8113a83de
commit 58ea4aed01
No known key found for this signature in database
GPG Key ID: 3E30B3F26C7B4AA2

View File

@ -148,7 +148,14 @@ export default async function(obj) {
let cover; let cover;
if (json.artwork_url) { 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 { return {