spotipy/examples/show_artist_top_tracks.py
Ryan K. Lee e3185e22ec Update show_artist_top_tracks.py
Import SpotifyClientCredentials from spotipy.oauth2
2020-01-11 19:54:21 +00:00

19 lines
460 B
Python

# shows artist info for a URN or URL
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
import sys
import pprint
if len(sys.argv) > 1:
urn = sys.argv[1]
else:
urn = 'spotify:artist:3jOstUTkEu2JkjvRdBA5Gu'
client_credentials_manager = SpotifyClientCredentials()
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
response = sp.artist_top_tracks(urn)
for track in response['tracks']:
print(track['name'])