From c5737094711fd5505ff41b1a6a46ea79cae1a535 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Sat, 19 Sep 2020 10:37:50 +0200 Subject: [PATCH] Fixed #49 --- deemix/api/deezer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/deemix/api/deezer.py b/deemix/api/deezer.py index 8f0e128..145a18d 100755 --- a/deemix/api/deezer.py +++ b/deemix/api/deezer.py @@ -63,10 +63,13 @@ class Deezer: json={'sng_id': sng_id}, headers=self.http_headers ) + result_json = site.json() except: eventlet.sleep(2) return self.get_track_filesizes(sng_id) - response = site.json()["results"] + if len(result_json['error']): + raise APIError(json.dumps(result_json['error'])) + response = result_json.get("results") filesizes = {} for key, value in response.items(): if key.startswith("FILESIZE_"):