Spotify + Python = ❤

Manpreet Singh
2 min readAug 18, 2024

Welcome back! Spotify is one of the biggest music streaming platforms out there, and they have an official API that many developers use. However, there’s now an unofficial API built right into Python! Let’s take a look at this API.

If you’re interested in exploring it, here’s a link to their GitHub page:

This API offers a wide range of capabilities. If you want to install it, simply use the following pip command:

pip install spotapi

One of the great things about this API is that it doesn’t require any API keys. It uses browser requests to interact with Spotify. If you prefer not to use any of your private information, you can still make simple requests with the following sample code (from their GitHub page):

"""Here's the example from spotipy https://github.com/spotipy-dev/spotipy?tab=readme-ov-file#quick-start"""
from spotapi import Song

song = Song()
gen = song.paginate_songs("weezer")

# Paginates 100 songs at a time till there's no more
for batch in gen:
for idx, item in enumerate(batch):
print(idx…

--

--

Manpreet Singh
Manpreet Singh

No responses yet