r/TrueOpenSource • u/Major-Ad-4196 • 2d ago
Contribution: Developer Tools I built an open-source Python library by reverse-engineering Spotify's web player — no API key needed
I started reverse-engineer Spotify when I was 15 because I wanted to make things with Spotify without dealing with their official API's restrictions for my own private projects. Almost four years later, it's turned into a fully async Python library, and I figured I'd share it here.
What it does: SpotAPI lets you search Spotify's catalogue, fetch tracks, artists and playlists, manage your library, and control existing Spotify players using the same private APIs as Spotify's web player. You don't need an API key for public data, and supported playback controls work without Premium. The GIF shows one of the terminal interfaces I built on top of the library.
Who it's for: Python developers building Spotify integrations, music discovery tools, playlist managers, or just anyone who enjoys messing around with APIs.
Source code: https://github.com/Aran404/SpotAPI
License: GPL-3.0
Closest existing projects: Spotipy and librespot-python.
What mine adds: Spotipy wraps Spotify's official API, while SpotAPI uses reverse-engineered web-player endpoints, so you can access public Spotify data without developer credentials and use features the official API restricts. It's fully async, typed, and comes with a CLI, interactive terminal interface, and desktop app. Unlike librespot, it's not trying to stream audio itself. It controls your existing Spotify player.
Builds on: N/A — it's an independent implementation, not a fork of another Spotify library.
How it was built: AI-assisted.
V1 was pretty much entirely handwritten when I was 16. I genuinely loved coding back then, and I remember spending mornings before school just reading through my own code because I was proud of how clean it was (a little egotistical, I know).
By the time I started rewriting everything for V2, AI had gotten ridiculously good at programming. So I used it. I still wrote a lot of the rewrite myself, made the architectural decisions, and spent plenty of time reviewing, testing, and auditing the code. I'm not going to pretend the whole thing was handwritten, though.
One of the more annoying technical challenges was dealing with Spotify's undocumented GraphQL queries, since they can change whenever Spotify updates its web player. SpotAPI handles discovering and caching those queries instead of relying entirely on hardcoded IDs.
Feedback/contributions wanted: I'd genuinely appreciate feedback on the API design, code quality, or features you think are missing. It's been a personal project for almost three years, and I'd love to see other people build things with it.
If you want to try it:
pip install spotapi
python -m spotapi search "Daft Punk"
And just to clarify, SpotAPI doesn't stream or download music. It works with Spotify's existing players.
•
u/trueopensource-bot 🤖 Robot 2d ago
About this project · Aran404/SpotAPI
⭐ 894 stars · 🍴 96 forks · 👥 16 contributors · 📄 GPL-3.0
History: started Jul 2024 · last code change today · 53 commits on 12 different days in the last 90 days
Releases: latest v2.1.3 (today) · 4 releases in the last 90 days
Open issues and pull requests: 1
How it was built: the author says people wrote this, with AI helping along the way. (More on our labels: rule 4.)
Facts from GitHub when this was posted. I'm a bot.
2
u/Nothsa2110405 2d ago
but its web version...