The Great Escape Festival 2015 Spotify Playlist
It’s that time of the the year again. The Great Escape Festival announced the first 150 artists on their bill and I’ve compiled them into a handy Spotify playlist.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
import spotipy artists = ['names', 'of'. 'artists'] def getArtist(artist): spotify = spotipy.Spotify() results = spotify.search(q='artist:' + artist, type='artist') if results['artists']['total'] > 0: for a in results['artists']['items']: if a['name'].lower() == artist.decode('utf-8').lower(): return a return None else: return None def getTop5(artist): artist_obj = getArtist(artist) if not artist_obj: return None artist_id = artist_obj['id'] spotify = spotipy.Spotify() results = spotify.artist_top_tracks(artist_id, country='GB') return results['tracks'][:5] with open('TGE15.txt', 'w') as f: for a in artists: tracks = getTop5(a) if tracks: for t in tracks: f.write(t['uri']+'\n') |