commit ce4f4eaf91a1357c364977aef19479a246d18dfb Author: Xevion Date: Sun Oct 27 13:34:19 2019 -0500 initialization diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e3c01b8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +__pycache__/** +tracks/** +cache_xevioni/** +.cache-* \ No newline at end of file diff --git a/auth.py b/auth.py new file mode 100644 index 0000000..c52bfdb --- /dev/null +++ b/auth.py @@ -0,0 +1,9 @@ +username = "xevioni" +client_id = "20cc828edc7140d88e1c8b0c08ed1672" +client_secret = "519fb97148a14952859ca3454b886cf9" +redirect_uri = "http://localhost:8888/callback" +scope = ' '.join([ + 'user-library-read', + 'user-read-recently-played', + 'user-top-read' +]) \ No newline at end of file diff --git a/pull.py b/pull.py new file mode 100644 index 0000000..d0ee8d7 --- /dev/null +++ b/pull.py @@ -0,0 +1,25 @@ +import auth +import json +import pprint +import spotipy +import spotipy.util as util + +# Get Authorization +token = util.prompt_for_user_token( + username=auth.username, + scope=auth.scope, + client_id=auth.client_id, + client_secret=auth.client_secret, + redirect_uri=auth.redirect_uri +) +sp = spotipy.Spotify(auth=token) +saved_response = sp.current_user_saved_tracks(limit=50, offset=100000) +# saved_response = json.load(open('saved_tracks.json', 'r')) +json.dump(saved_response, open('saved_tracks.json', 'w+')) +pprint.pprint(saved_response) +# for track in saved_response['items']: +# print('{} by {}'.format( +# track['track']['name'], +# ' & '.join(artist['name'] for artist in track['track']['artists']) +# )) +