spotipy/examples/tracks.py
2014-08-22 13:48:31 -04:00

13 lines
325 B
Python

# shows tracks for the given artist
from __future__ import print_function
import spotipy
import sys
sp = spotipy.Spotify()
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'])