r/ReverseEngineering • u/Major-Ad-4196 • 10d ago
I reverse-engineered Spotify's private API and turned it into an async Python library — no API key required
https://github.com/Aran404/SpotAPI
1.1k
Upvotes
77
u/Major-Ad-4196 10d ago •
Hey everyone!
I started reverse-engineering Spotify's web player when I was 15. What began as a small Python wrapper turned into a two-year project exploring how much of Spotify's functionality could be accessed without going through its official developer API.
The interesting part wasn't just finding undocumented endpoints. It was figuring out how to make them reliable enough for other developers to actually build on.
Some of the challenges:
I recently rewrote the whole library around asyncio. It's called SpotAPI, and I wanted to make it useful beyond just demonstrating that these endpoints exist.
If you want to play around with it, there's an interactive terminal browser:
That opens a Spotify catalogue explorer in your terminal. No API key, account, Premium subscription, or configuration required.
Underneath it is the actual async Python library, which you can use for searches, metadata, recommendations, playlists, and authenticated player control.
One limitation worth mentioning: this doesn't bypass Spotify's DRM or stream audio. Playback controls an existing Spotify device.
Source: https://github.com/Aran404/SpotAPI
I'd especially love feedback from people who've reverse-engineered APIs that change frequently. How do you handle breaking changes in undocumented protocols without turning your codebase into a pile of workarounds?
And if you find the project useful or interesting, consider giving it a star. It helps more developers discover the work.
Thanks for checking it out!
60
u/SigridFischer42 10d ago •
Set a custom User-Agent header to avoid getting blocked when using /api/v1/access/.
18
u/Salamandar3500 9d ago
This project is still up 9 hours after ? Github DMCA takedowns are slow these days.
6
u/adzm 9d ago
If only Spotify would show the bpm and keys without me having to make a new playlist and turn on mix mode. This is pretty useful even if just for that
6
u/Secret-Quit5400 8d ago
Wait, so you can actually sync lyrics with Spotify and click on a line to jump to that part of the song? That's pretty cool lol. Does that work without Premium too? Curious how you got that working.
3
u/CXgamer 8d ago
I have multi room audio controles by HomeAssistant but without a subscription to a streaming service, best I could do was a web radio.
I'll be trying this out later! Hopefully I'll finally have a good audio source with this!
2
u/mirh 9d ago
Wasn't librespot-python enough?
2
u/Either-Banana-7323 9d ago
Super cool project man. Thanks for sharing it
2
u/kiwipaul17 7d ago
Will try
2
u/MyNameIsCheesus 7d ago
Dumb question, what does this do that the Spotify app doesn't? Beside for home assistant. Also, you said no API token needed, does that mean anyone can play music bumping into ads?
2
u/cat_dev_null_sync 9d ago
So now Spotify has a reason to lock this down?
1
u/Major-Ad-4196 7d ago
For anyone curious what the reverse-engineered playback controls actually look like, here's a quick demo of SpotAPI Studio controlling a real Spotify player in real time. Track switching, playback controls, likes, and more, all without needing Spotify Premium. Pretty satisfying seeing both stay in sync.
1
u/scythe000 9d ago
Could I use this to show bpm in search results and random playlists?
1
u/d_e_g_m 5d ago
How are ads managed?
0
u/p1-o2 9d ago
Okay now make it stream audio too. I want to access Spotify without using Spotify app. I have a paid account.
Please? 🥺
1
u/Free_Layer_8233 3d ago
Cool
0
u/[deleted] 9d ago
[deleted] — view deleted comment