On this project I wanted to learn how to pull data from Spotify. I love Spotify Wrapped and want to eventually code something of that level of sophistication. For now I decided to start with something basic and compare the top tracks of Eric Prydz and his alias Pryda.
Using the Spotify API was easy to setup. I just created an app on Spotify for Developers and used the Redirect URI as http://localhost/. Once the app is created all I needed for my code was the Client ID and Client Secret.
Since I want to keep my Client ID and Secret keys private, I created a text file named .env and set my Client ID and Secret variables. My code was having troubles reading the .env file so once I removed the extra spaces and empty lines that fixed the issues. This tutorial was very useful.
In python, Spotify has its own library called Spotipy. Reading through the Spotipy library helped me learn how to pull data from Spotify.
I was able to compare the top tracks between Eric Prydz and Pryda. The graph below shows the Eric Prydz is more popular than his alias Pryda. It also shows that his top track is “Call on Me” which is the song that made him popular but ironically his least favorite song.
My full code is posted on my GitHub. For my next project I was thinking of pulling data from my playlists.