Creating Spotify Playlists via the Spotify API

08-20-2023

I've recently pushed code to Github for a little hobby project I've been working. There are public radio music shows that I enjoy but am often not able to listen to because they are aired at a time that I'm busy. It's more convenient to listen on demand. I also spend most of my listening time in the Spotify app so I would rather listen there even if the show offers a feed from their site, and many don't.

While exploring the possibility of creating Spotify playlists of these shows, I learned that many of them publish their playlists on their show sites using an undocumented API provided by National Public Radio. I was able to use my browser to determine what HTTP calls I need to make to get the latest episodes and the tracks played. I was then able (after a rather steep learning curve) use the Spotify API to create playlists for the shows I'm interested in.

Now I'm able to run a script that will harvest the playlists for shows I'm interested in and update Spotify playlists that I can listen to at my convenience. I miss the DJ's introduction to songs and any local flavor of the show but it allows me to hear the music on demand. As I listen, the tracks become part of my Spotify listening history that can be mined by Spotify to offer me additional recommendations.

Since there were a few technical hurdles, mostly around authentication, with the Spotify API, I posted my code for others to review. I may post more in-depth about this later. The project README also includes more details on how to get started with the Spotify API.

Here are some of the shows I'm harvesting and their corresponding public Spotify playlist that I've created. You should still donate to your favorite public radio station.