Skip to content

Instantly share code, notes, and snippets.

@plamere
Last active August 29, 2015 14:02
Show Gist options
  • Save plamere/20fcce40694e788a4904 to your computer and use it in GitHub Desktop.
Save plamere/20fcce40694e788a4904 to your computer and use it in GitHub Desktop.
Get Spotify images for the artists that are similar to weezer
import pyen
import spotipy
import sys
'''
get a set of images for artists that are similar to
the given seed artist
'''
en = pyen.Pyen()
sp = spotipy.Spotify()
spids = []
response = en.get('artist/similar', name='weezer', bucket='id:spotify', limit=True)
for artist in response['artists']:
spids.append(artist['foreign_ids'][0]['foreign_id'])
for artist in sp.artists(spids)['artists']:
print artist['images'][0]['url'], artist['name']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment