Skip to content

Instantly share code, notes, and snippets.

@samirfor
Created April 25, 2017 17:26
Show Gist options
  • Save samirfor/e1920ae7425047b90eb1df8b493d638f to your computer and use it in GitHub Desktop.
Save samirfor/e1920ae7425047b90eb1df8b493d638f to your computer and use it in GitHub Desktop.
>>> import spotipy
>>> import sys
>>> import pprint
>>>
>>> if len(sys.argv) > 1:
... urn = sys.argv[1]
... else:
... urn = 'spotify:artist:3jOstUTkEu2JkjvRdBA5Gu'
...
>>> sp = spotipy.Spotify()
>>>
>>> artist = sp.artist(urn)
>>>
>>> pprint.pprint(artist)
{'external_urls': {'spotify': 'https://open.spotify.com/artist/3jOstUTkEu2JkjvRdBA5Gu'},
'followers': {'href': None, 'total': 852003},
'genres': ['alternative metal',
'alternative rock',
'blues-rock',
'garage rock',
'indie christmas',
'indie pop',
'indie rock',
'nu metal',
'permanent wave',
'pop christmas',
'pop punk',
'pop rock',
'post-grunge',
'punk christmas',
'rock'],
'href': 'https://api.spotify.com/v1/artists/3jOstUTkEu2JkjvRdBA5Gu',
'id': '3jOstUTkEu2JkjvRdBA5Gu',
'images': [{'height': 640,
'url': 'https://i.scdn.co/image/9cb88ed26eeb1318d4ddb4cbb6d4b77d0e5f10a3',
'width': 640},
{'height': 320,
'url': 'https://i.scdn.co/image/a76770bdc3ee61cde6b7786c27efccc3f28e9e3f',
'width': 320},
{'height': 160,
'url': 'https://i.scdn.co/image/4a868f199b8c69ae0d8557c0f7884072acbcdb83',
'width': 160}],
'name': 'Weezer',
'popularity': 72,
'type': 'artist',
'uri': 'spotify:artist:3jOstUTkEu2JkjvRdBA5Gu'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment