Inspiration

Spotify is the top app for music. However, it only streams the music to your phone but doesn't allow you to download it. Premium users can download songs, but they are in an encrypted format that must be opened using Spotify. There are users around the world who use Spotify, but they have to pay a monthly fee for premium. And the users who don't use premium, like myself, can only listen to music when there's an available internet connection. I already have tons of playlists that have all my music, and I would like to listen to them without an internet connection.

What it does

A user has to go to spotify, get the playlist's url, and simply paste it into the application. The app then retrieves the songs and downloads them directly to your system.

How I built it

Using the Spotify API, the playlist's JSON file is retrieved that houses the entire playlist's list of tracks including the song names and artists. Using a Youtube API, the song name and artist is queried, and the youtube video of the song is determined. Using youtube-dl, the video is then converted to an mp3 file, and placed into playlist folder. To make it run very efficiently, this program was written as a multi-threaded program, where songs are downloaded in parallel.

Challenges I ran into

I ran into a lot of problems when developing this application. I had to read and decipher the JSON file. Some of Spotify's API doesn't work, and I had to find ways to work around using it. It was also hard to implement the program to be multithreaded. At first, I had a mistake that I had to debug for a very long time in which the threads were all using the same resource at the same time. There were a lot of other issues I ran into as well that took hours to debug, including the learning curve of learning to use python and installing the python libraries into a virtual environment called Anaconda.

Accomplishments that I'm proud of

I am proud that I was able to make the program multithreaded. This made the program take 20 seconds to download a song to 5 seconds. However, for the sake of time, I haven't tested it further to see if it can download it even faster.

What I learned

I learned how to use Python in Anaconda. I learned how to use global path variables and manipulate them and manipulate installing different python modules. I learned how to program in parallel in Python, and I learned how to use the Spotify and Youtube API's.

What's next for SpotifyMP3

I would like to implement an interactive GUI with this application. The program is a script that must be run on terminal, and it works by itself, so this would be a additional, supplementary feature.

Share this project:
×

Updates