spotipy/examples/show_artist_top_tracks.py
Mason Stephenson edd3f29a2c
Getting Started Clarifications and Example Code File (#904)
* added URI link to README getting started

* revised comment

* added alternate module installation instruction

* installation troubleshooting comment

* scope clarification comment

* added playlist_add_items.py to examples folder

* reformatted changelog edits

* Relocated added contributions to added section in Changelog

* removed unnecessary library installation instruction

* Clarified alternative installation instruction
2022-12-10 16:27:29 +00:00

18 lines
432 B
Python

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