Spotify Playlists Based On Radio Station

I’ve created application that updating Spotify Playlists based on songs that played in radio stations.

Yaniv Lerman
3 min readNov 20, 2020

Hey everyone, I would like to share with you my application that updating Spotify playlists based on the songs that played in radio stations.

TLDR; If you just want the links to the playlists scroll to the end of this article.

The Motivation

So my motivation to create this application is that I love very much the music that played on some radio station however lot of radio station have broadcaster, commercials and other stuff that cut the music and interrupting the pleasure of listening, in addition sometimes there is specific song that I would like to skip or to repeat it, generally I would like to control the music that played sometimes so I decided to create application that recognize the song that currently played on the radio station and immediately updating a Spotify playlist.

The Application

So the application based on NodeJS and running on AWS EC2.
Each interval of 30 seconds the application executed and the app have 4 main steps for each radio station I’m targeting:

  1. Radio Station Recording
  2. Song Recognition
  3. Find the songs in Spotify
  4. Add song to playlist

1. Radio Station Recording

In order to record the song I was looked for the radio station broadcast on the internet, once I found it I’ve extracted the HTTP request that fetching the music from the radio station, I’ve triggered this request from my application and fetched a certain amount of bytes then converted it to MP3, this is how I got couple of seconds from the radio.

2. Song Recognition

In order to recognize the song I was looking for services like Shazam that have API so I’ll be able to use in my application, so I found AcrCloud and AudD, that have great API so you can send partial song and get the name of it, sometimes this API gives you direct URL for the song in Spotify so if this the case the application can skip step 3.

3. Find the songs in Spotify

If the song recognition service wasn’t supplied me the reference to Spotify and suppling me only the song author and title I had to find it by myself, In order to find the song I used Spotify API to do search in Spotify database, this step was very challenging, because some of the songs the application is looking for are foreign and you can never know how these songs are saved in Spotify and how you got the result from the song recognition service, the song name can be written in his original language, it can be translated to English or some other permutations of the song name, unfortunately in Spotify search API you must provide the name of the songs exactly without any mistakes, so to make sure I’m searching for all the possible permutations of the song author and song name I’ve took the name and author the the song recognition service provided me and used couple of services that helped me to find all the possible ways to write the name of the song and the writer, these services are: Deezer, Discogs, Musixmatch and Google Translate, once I’ve produced all the possible permutations I’ve send them all to Spotify to find the song.

4. Add song the song to playlist

Each radio station has it’s own Spotify playlist, so once I found the song and the song not appear already in the playlist I’ve added it to the playlist, if its already there (could be played couple of hours before) I bumping it to the first song in the playlist.

This is how I got radio station music without any interrupts and the ability to control what I hear and what not :)

You can check for yourselves, open the radio station, open my playlist, check what is the current song that is played and see how after couple of seconds he getting updated in the playlist :

The Playlists

British Radio Stations

Israeli Radio Station

Donation

I would like to add more station however each radio station I’m adding adds more traffic which cost me more every month.
If I won’t be able to maintain this application I’ll have to close it unfortunately :(
So if you like my application you can help me maintain it and donate :)
Who is donate more then 60$ I’m promise to do everything to add its favorite radio station!
Donation Link:
BuyMeACoffe

--

--