Inspect Spotify's top hits playlists and see what we can learn.
- What kind of data does Spotify extract and keep for each song? (which in turn helps it recommend songs to us)
- How have the properties of top-hit songs changed over the last few decades?
This project also has code to query Spotify's servers for the most up-to-date data using HTTPS (same protocol used by Chrome and all browsers to serve webpages to you). A little more detail below.
-
Ask Spotify for permission to pull data from its servers. This requires an "OAuth token", which is a password that's only valid for 1 hour, details at footnote (1). The instructions show a Javascript way of getting the password, but you can do it in Python too.
-
Using the OAuth token, send HTTPS requests to Spotify's servers to get the data. Then, process the data -- pick out only the pieces we want, and discard the rest (this requires lots of experimenting, not shown in the final code). This is all done in the notebook:
get_data.ipynb
-
Make a home-made library, to try to present the data in a cleaner way for coding club. You can see the actual code for the
get(...)
andshow_data(...)
methods in:coding_club.py
Footnotes