implemented album fallback

This commit is contained in:
RemixDev 2021-12-22 13:01:07 +01:00
parent c978e9a74c
commit db67883f90
No known key found for this signature in database
GPG key ID: B33962B465BDB51C

View file

@ -78,7 +78,13 @@ async function generateAlbumItem(dz, id, bitrate, rootArtist){
id = albumAPI.id id = albumAPI.id
} else { } else {
try{ 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){ } catch (e){
console.trace(e) console.trace(e)
throw new GenerationError(`https://deezer.com/album/${id}`, e.message) throw new GenerationError(`https://deezer.com/album/${id}`, e.message)