Turn a Spotify playlist into a Jekyll post

code • June 22, 2018

For the past ten years, I’ve created a playlist for each season. I wrote about this before when I made Jekyll data playlists. At the end of each season, the playlist gets a post and I store all the data in _data/playlists.yml (for safe keeping).

:scream: Tired: Doing this work manually.

:sunglasses: Wired: Using this handy script.

Under the hood

  1. The script gets the playlist from Spotify.
  2. Next, it formats the tracks with exactly the data I’ll need for later.
  3. With the new dataset, it creates a post and formats it to my liking.
  4. Then updates the master playlist by reading the file, appending the new data, and then saving it.
  5. Finally, the script downloads the playlist image.

When I’m ready to turn a Spotify playlist into a post, I run from terminal:

spotify-to-jekyll --playlist=<playlist-id>

In a few seconds, the script has updated _data/playlist.yml, created a new post, and downloaded a thumbnail image for the post.

GitHub app displaying the three files that have been downloaded

You can find the code on GitHub to learn how to set it up for yourself.

Keep reading code