I am trying to get the currently playing track's cover to put on a separate window. I am using Spotipy, and I cannot seem to find how to get the track's image. Is there any way to get the cover using Spotipy?
Asked
Active
Viewed 166 times
1 Answers
-1
I've never used spotipy, but I checked out the docs quickly and the second example on the Getting Started page shows how to get the URL for an album image. The next example shows how to get the image for a given artist. I'll show the one that references album art:
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
lz_uri = 'spotify:artist:36QJpDe2go2KgaRleHCDTp'
spotify = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials())
results = spotify.artist_top_tracks(lz_uri)
for track in results['tracks'][:10]:
print('track : ' + track['name'])
print('audio : ' + track['preview_url'])
print('cover art: ' + track['album']['images'][0]['url'])
print()