spotipy/examples/tracks.py

13 lines
325 B
Python
Raw Normal View History

2014-04-05 09:12:01 -04:00
# shows tracks for the given artist
2014-04-05 22:06:52 +03:00
from __future__ import print_function
2014-04-05 09:12:01 -04:00
import spotipy
import sys
sp = spotipy.Spotify()
if len(sys.argv) > 1:
artist_name = ' '.join(sys.argv[1:])
2014-08-22 13:40:15 -04:00
results = sp.search(q=artist_name, limit=20)
for i, t in enumerate(results['tracks']['items']):
2014-04-05 22:06:52 +03:00
print(' ', i, t['name'])