From 0c4db05db1cdaf28b27ab3ad0ce797e57ef03f0e Mon Sep 17 00:00:00 2001 From: RemixDev Date: Tue, 28 Dec 2021 09:10:31 +0100 Subject: [PATCH] fixed KeyError issue when downloading single --- deemix/itemgen.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deemix/itemgen.py b/deemix/itemgen.py index ec0881c..5b3b715 100644 --- a/deemix/itemgen.py +++ b/deemix/itemgen.py @@ -36,7 +36,7 @@ def generateTrackItem(dz, link_id, bitrate, trackAPI=None, albumAPI=None): else: cover = f"https://e-cdns-images.dzcdn.net/images/cover/{trackAPI['md5_image']}/75x75-000000-80-0-0.jpg" - del trackAPI['track_token'] + if 'track_token' in trackAPI: del trackAPI['track_token'] return Single({ 'type': 'track', @@ -108,7 +108,7 @@ def generateAlbumItem(dz, link_id, bitrate, rootArtist=None): collection = [] for pos, trackAPI in enumerate(tracksArray, start=1): trackAPI = map_track(trackAPI) - del trackAPI['track_token'] + if 'track_token' in trackAPI: del trackAPI['track_token'] trackAPI['position'] = pos collection.append(trackAPI) @@ -159,7 +159,7 @@ def generatePlaylistItem(dz, link_id, bitrate, playlistAPI=None, playlistTracksA trackAPI = map_track(trackAPI) if trackAPI['explicit_lyrics']: playlistAPI['explicit'] = True - del trackAPI['track_token'] + if 'track_token' in trackAPI: del trackAPI['track_token'] trackAPI['position'] = pos collection.append(trackAPI)