It isn't difficult adding one or two songs that I find on Youtube to Spotify quickly, but once I find myself wanting to add tens of songs that I found on Youtube to Spotify, it gets very laborious. Thus I decided that this would be a useful project that would also let me familiarize myself with the Youtube Data API and Spotify Web API, both of which I have meant to learn more about before.

What it does

This application takes a look at all of the videos in one of your Youtube playlists, checks to see if the video is a video of a song that is also on Spotify, and if so, adds the same song to your Spotify Liked Songs playlist.

How I built it

I used Python, the Youtube Data API, the youtube-dl library and Spotify Web API to build this application. The Youtube Data API was used to get all of the videos of a Youtube playlist, the youtube-dl library was used to get the artist and song from each Youtube video, and the Spotify Web API was used to search for the Youtube song on Spotify and then add it to the Spotify Liked Songs playlist.

Challenges I ran into

I have never used either API before, and generally am not very familiar of APIs, so I had trouble understanding exactly which parts of APIs I needed in my code, how to get credentials, etc. I also initially did not know that I needed the youtube-dl library, but after some research, I came to learn that the Youtube Data API does not easily let me know the artist and song title of a youtube music video and that the youtube-dl library would do this instead. Also, doing this project alone was rough, although manageable.

Accomplishments that I'm proud of

I was able to troubleshoot all of my problems well, and learned about the Youtube Data API and Spotify Web API, and was able to do the entire project in Python, a language I am still not very fluent in.

What I learned

I learned more about the general functionality of APIs and how to use them effectively, and learned a little bit more about Python.

What's next for YTtoSpotify

Rather than adding all Youtube videos to a single Spotify playlist, I will take this further to see how I can parse the Youtube video to the Spotify API, then analyze the type of song the song is with Spotify API's ability to look into components of songs such as danceability, energy, etc. to then fit the song into the desired playlist; this would be done, for example, by putting the sad songs into one playlist, the energetic songs into another, and so on.

Built With

Share this project: