mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-10-29 18:00:15 +00:00
Catch only IndexError
This commit is contained in:
@@ -30,7 +30,7 @@ def generate_metadata(raw_song):
|
|||||||
# otherwise search on spotify and fetch information from first result
|
# otherwise search on spotify and fetch information from first result
|
||||||
try:
|
try:
|
||||||
meta_tags = spotify.search(raw_song, limit=1)['tracks']['items'][0]
|
meta_tags = spotify.search(raw_song, limit=1)['tracks']['items'][0]
|
||||||
except:
|
except IndexError:
|
||||||
return None
|
return None
|
||||||
artist = spotify.artist(meta_tags['artists'][0]['id'])
|
artist = spotify.artist(meta_tags['artists'][0]['id'])
|
||||||
album = spotify.album(meta_tags['album']['id'])
|
album = spotify.album(meta_tags['album']['id'])
|
||||||
|
|||||||
Reference in New Issue
Block a user