initialization

This commit is contained in:
Xevion
2019-10-27 13:34:19 -05:00
commit ce4f4eaf91
3 changed files with 38 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
__pycache__/**
tracks/**
cache_xevioni/**
.cache-*

9
auth.py Normal file
View File

@@ -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'
])

25
pull.py Normal file
View File

@@ -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'])
# ))