Is it possible to not use Spotify in 2020? I tried. Here’s how.
One of the main functions of spotify was to
supply users with music content. For maximum control I wanted all music I consumed to
reside on my hard drive. I decided to download all music I listened to in Spotify
The first step was to export all liked songs
and playlists from Spotify. I used the tool exportify.net
for this purpose. Since it exports only playlists, not liked songs, I created a new playlist i like
and added all liked songs to that playlist in Spotify.
Next, on exportify, The Export All button didn’t work for me so I downloaded each playlist individually.
This step yielded a bunch of csv files which I saved in data/spotify.
I used the following function to read one of the playlist files.
I used the youtube-search python package to search each song on YouTube.
As you can see, I tried a few different search queries for each song from very specific
(including artist and song title) to more general (including only artist or title) in order
to get a result at least somewhat similar to the original track in case there wasn’t an exact match.
Last but not least, I converted the downloaded mp4 audio stream files to ogg files
with the help of the ffmpeg cli tool (apt install ffmpeg).
Finally, putting it all together.
Occasionally, a download would fail so I added some logic to keep track
of done songs in order to enable easy restarts.
A few hours later, I had my entire music collection on my hard drive.
I deleted the mp4s with rm *.mp4.
One problem I observed was that many YouTube music videos had a bunch of speech in them,
usually in the beginning before the song started.
To fix this, one could try to employ some sort of automatic detection of the non-music
part and cut it off. Or find a different data source.
I might explore one of these options at a later time.