mirror of
https://github.com/c0de-archive/spotipy.git
synced 2024-09-08 10:37:36 +00:00
31 lines
604 B
Python
31 lines
604 B
Python
# shows a user's playlists (need to be authenticated via oauth)
|
|
|
|
import pprint
|
|
import sys
|
|
import os
|
|
import subprocess
|
|
|
|
import spotipy
|
|
|
|
import util
|
|
import spotipy.oauth2 as oauth2
|
|
|
|
|
|
|
|
if len(sys.argv) > 1:
|
|
username = sys.argv[1]
|
|
else:
|
|
print "Whoops, need your username!"
|
|
print "usage: python user_playlists.py [username]"
|
|
sys.exit()
|
|
|
|
token = util.prompt_for_user_token(username)
|
|
|
|
if token:
|
|
sp = spotipy.Spotify(auth=token)
|
|
playlists = sp.user_playlists(username)
|
|
for playlist in playlists['items']:
|
|
print playlist['name']
|
|
else:
|
|
print "Can't get token for", username
|