Want Music Recommendations? Look No Further.

I love listening to music, so I thought exploring the realm of music recommendations for a project would be really cool. It was awesome seeing the whole project come to life, and I thoroughly enjoyed adding little details and refreshing the page to see them go into effect. Below you can see the full UI for the site I made using Python and HTML’s.

For the app, I utilized Flask that pulls data from Spotify and Last.fm, blends audio features and similar-artist logic, and then serves up fresh song suggestions every time you hit “Search.” On the back end, I set up a Flask app that takes a user’s input (like “hotline bling drake”), calls Spotify’s API to grab the track and artist IDs, and then builds a “pool” of potential recommendations. First, I try Spotify’s built-in recommendations endpoint, but because it can be narrow, I also leverage Last.fm to find similar artists and then grab their top tracks from Spotify. If all that still doesn’t hit twenty songs, I fall back to pulling the original artist’s most popular tracks. Once I have my pool, I shuffle it so the user gets a random mix each time, then slice out the first three and send them back in a clean interface that shows album art, song title, artist, and a link to play the song on Spotify.

I also built in a “History” tab that shows all of the songs that you’ve been recommended. What’s cool about my app is that it won’t always give the same recommendations. As seen in the History tab, I searched “Norbit” by Bas twice, and got different results each time. This is especially useful if you’ve already heard all of the recommended tracks it gives you on the first attempt.

The coolest part was customizing the logic step by step. I’d tweak a filter or update the HTML for aesthetics, refresh the page to see the results, and feel like a mad scientist watching my experiment evolve. Debugging the API errors taught me a ton about real-world API quirks, and I even added fallback branches to handle missing data. But I noticed that even Spotify’s algorithm has mistakes too.

Halfway into my testing, I realized that even Spotify’s algorithm for recommending songs messes up sometimes. Chase Shakur is an Atlanta-born R&B singer and there are recommendations for songs that are completely unrelated.

Being able to combine my app with the recommendations that Spotify gives can allow music lovers to keep expanding their music taste in different ways. Where Spotify’s recommendation algorithm falters, mine can excel and vice versa. My app is a good starting point and works best for smaller artists especially if you have an expansive music taste and are interested in hearing music from artists you may have never heard before. I’ve already been able to find some great new songs from this method and I’m really glad I was able to have the opportunity to learn more about AI programming while being able to work on something I love.

Going forward, I am definitely interested in exploring the Spotify’s developer tools more in-depth and maybe even making AI agents or data-driven tools that can benefit music lovers in new and innovative ways. If you’re interested in trying it out for yourself, you can find the code and documentation on my Github here. Just make sure to get a Spotify Client ID & Client Secret and a LastFM API key.

Overall, the project pushed me to try something new with my programming skills and make my own app UI. It was awesome to see it all come to life and I’m looking forward to working on more projects similar to this one in the future.