From db67883f90b5b7121dd00f6e35499a3f8eed922e Mon Sep 17 00:00:00 2001 From: RemixDev Date: Wed, 22 Dec 2021 13:01:07 +0100 Subject: [PATCH] implemented album fallback --- deemix/itemgen.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/deemix/itemgen.js b/deemix/itemgen.js index 11b76af..809fa4d 100644 --- a/deemix/itemgen.js +++ b/deemix/itemgen.js @@ -78,7 +78,13 @@ async function generateAlbumItem(dz, id, bitrate, rootArtist){ id = albumAPI.id } else { try{ - albumAPI = await dz.api.get_album(id) + let albumAPI_gw_page = await dz.gw.get_album_page(id) + if (albumAPI_gw_page.DATA){ + id = albumAPI_gw_page.DATA.ALB_ID + albumAPI = await dz.api.get_album(id) + } else { + throw new GenerationError(`https://deezer.com/album/${id}`, "Can't find the album") + } } catch (e){ console.trace(e) throw new GenerationError(`https://deezer.com/album/${id}`, e.message)