I use an older iPod when I run, but my library of songs is mainly on Spotify. I wanted to transfer some of my playlists, but was unable to find a solution online. I therefore created a program that downloads playlists from Spotify to a file on a local disk.
It starts by the user selecting playlists to download, then using the Spotify API, the program retrieves the list of songs in each playlist. This is then used to populate the UI. The program then proceeds with the downloading process by matching the Spotify song to a YouTube video. It iterates this algorithm until the best, highest quality match is found. It then takes the link of that video, downloads it using youtubedl, converts it to mp3 using ffmpeg, and saves it to a disk. This process is then repeated for each of the remaining songs in the playlist.