This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import spotipy | |
import spotipy.util as util | |
def findTopSong(sp, artist, allTargetSongs): | |
allTopTracks = sp.artist_top_tracks(artist['id'] , country='US')['tracks'] | |
if len(allTopTracks) <= 3: return | |
singleTopTrack = allTopTracks[0] # Grabs top Track | |
allTargetSongs.append(singleTopTrack) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import spotipy | |
import spotipy.util as util | |
if __name__ == '__main__': | |
username = "<Your Username (or user number) here>" | |
token = util.prompt_for_user_token(username,scope = 'user-top-read',client_id='<Your client ID>',client_secret='<Your client Secret>',redirect_uri='http://localhost/') | |
if token: | |
print("Cool we authenticated") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import spotipy | |
import spotipy.util as util | |
if __name__ == '__main__': | |
username = "<Your Username (or user number) here>" | |
token = util.prompt_for_user_token(username,scope = 'user-top-read',client_id='<Your client ID>',client_secret='<Your client Secret>',redirect_uri='http://localhost/') | |
if token: | |
sp = spotipy.Spotify(auth=token) |