mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 09:13:53 +00:00
17 lines
448 B
Python
17 lines
448 B
Python
# shows tracks for the given artist
|
|
|
|
# usage: python tracks.py [artist name]
|
|
|
|
from spotipy.oauth2 import SpotifyClientCredentials
|
|
import spotipy
|
|
import sys
|
|
|
|
auth_manager = SpotifyClientCredentials()
|
|
sp = spotipy.Spotify(auth_manager=auth_manager)
|
|
|
|
if len(sys.argv) > 1:
|
|
artist_name = ' '.join(sys.argv[1:])
|
|
results = sp.search(q=artist_name, limit=20)
|
|
for i, t in enumerate(results['tracks']['items']):
|
|
print(' ', i, t['name'])
|