From 185c9c81b9b20be04179a8e92e339b7aae0bbf37 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Sun, 25 Jul 2021 15:23:32 +0200 Subject: [PATCH] Fixed get_tracks_url when tracks are not released yet --- deezer/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deezer/__init__.py b/deezer/__init__.py index b389197..7c6aba7 100644 --- a/deezer/__init__.py +++ b/deezer/__init__.py @@ -164,4 +164,6 @@ class Deezer: except requests.exceptions.HTTPError: return None - return response['data'][0]['media'][0]['sources'][0]['url'] + if response.get('data') and response['data'][0].get('media'): + return response['data'][0]['media'][0]['sources'][0]['url'] + return None