spotipy/examples/simple3.py

17 lines
334 B
Python
Raw Normal View History

2014-08-22 13:28:19 +00:00
import spotipy
import sys
spotify = spotipy.Spotify()
if len(sys.argv) > 1:
name = ' '.join(sys.argv[1:])
else:
name = 'Radiohead'
results = spotify.search(q='artist:' + name, type='artist')
items = results['artists']['items']
if len(items) > 0:
artist = items[0]
2015-06-05 09:07:28 +00:00
print(artist['name'], artist['images'][0]['url'])
2014-08-22 13:28:19 +00:00