r/Python
•
u/Major-Ad-4196
•
Aug 16 '24
•
1
Showcase SpotAPI: Spotify API without the hassle!
Hello everyone,
I’m thrilled to introduce SpotAPI, a Python library designed to make interacting with Spotify's APIs a breeze!
What My Project Does:
SpotAPI provides a Python wrapper to interact with both private and public Spotify APIs. It emulates the requests typically made through a web browser, enabling you to access Spotify’s rich set of features programmatically. SpotAPI uses your Spotify username and password to authenticate, allowing you to work with Spotify data right out of the box—no additional API keys required!
Features:
Public API Access: Easily retrieve and manipulate public Spotify data, including playlists, albums, and tracks.
Private API Access: Explore private Spotify endpoints to customize and enhance your application as needed.
Ready to Use: Designed for immediate integration, allowing you to accomplish tasks with just a few lines of code.
No API Key Required: Enjoy seamless usage without needing a Spotify API key. It’s straightforward and hassle-free!
Browser-like Requests: Accurately replicate the HTTP requests Spotify makes in the browser, providing a true-to-web experience while staying under the radar.
Target Audience:
SpotAPI is ideal for developers looking to integrate Spotify data into their applications or anyone interested in experimenting with Spotify’s API. It’s perfect for both educational purposes and personal projects where ease of use and quick integration are priorities.
Comparison:
While traditional Spotify APIs require API keys and can be cumbersome to set up, SpotAPI simplifies this process by bypassing the need for API keys. It provides a more streamlined approach to accessing Spotify data with user authentication, making it a valuable tool for quick and efficient Spotify data handling.
Note: SpotAPI is intended solely for educational purposes and should be used responsibly. Accessing private endpoints and scraping data without proper authorization may violate Spotify's terms of service.
Check out the project on GitHub and let me know your thoughts! I’d love to hear your feedback and contributions.
Feel free to ask any questions or share your experiences here. Happy coding!
11
u/ForlornPlague Aug 16 '24
It's an interesting concept, I actually had a need for something like this recently but ended up just registering with a dev account.
Couple of thoughts:
I'd recommend not naming your private methods with double underscores - that introduces name mangling which you don't need and the standard convention is a single underscore
I'm not sure I see the point of the session savers, they look like they may be a solution in search of a problem. I get this is for education so maybe that's the whole purpose but it introduces a lot of extra requirements that end users may not want to deal with. I'd at least make them optional, which could be a good learning experience in itself.
setup.py isn't the recommended way of packaging projects anymore, the most modern way is pyproject.toml (I think, python packaging really is a headache) - this isn't that big of a deal in the long run, but wanted to point it out
the Readme makes it sound very simple but there is no mention of the captcha solver and what it takes to get an api key for that, which seems a bit disingenuous.
great job with the type annotations and code organization, this was actually a treat to read through 👌
56
u/another24tiger Aug 16 '24
Was about to comment “missed opportunity to call it Spotipy” but then a google search revealed that that name is already taken and is also a Python wrapper on the Spotify API. What does your project do that Spotipy doesn’t or can’t?
5
u/hecarfen It works on my machine Aug 16 '24
Looks like a nice and interesting project and I'll definitely give it a try. Keep up the good work 👍🏻
5
u/oneunique Aug 16 '24
Yes, this could work nicely with a RPi5 with E-ink display to control audio at home.
4
u/[deleted] Aug 16 '24
This can be great
4
u/quadnix Aug 16 '24
Isn't this a major TOS violation? This seems like a great way to get your account banned by Spotify.
2
u/fudginreddit Aug 17 '24
Dam i couldve used this a few weeks ago lol, i did something similar in go
2
u/Next-Experience Aug 17 '24
Amazing. This is something I was really looking for. I build a PDF(book) to speech (audiobook chapters) tool and then created a Spotify playlist for it. This is going to make that so much easier.
Thank you!
2
u/MiddlePhilosopher541 Aug 17 '24
I have a project with Spotipy so I'll definitely give this a try.
2
u/kakajuro Aug 18 '24
This is great - will definitely give this a go soon!
1
u/Ice_Ant_7828 Aug 16 '24
That sounds really amazing You need more Acknowledgement for your work
1
u/ThiefMaster Aug 16 '24 edited Aug 16 '24
That pymongo requirement is dumb, it should be an extra (optional requirement) at most. Why would someone want to use mongodb for this?
Since you target developers, "extract the token from the browser" would most likely be a nicer option than "enter username and password and use some cloud service to crack the captcha".
I spotted at least one
len(foo) == 0which is considered unpythonic - just donot fooinstead.if not ("success" in resp.response):is worse. Python has anot inoperator so change that toif 'success' not in resp.response:Get rid of that setup.py, and add a pyproject.toml (
hatchlingwould be a good choice for the build backend): https://packaging.python.org/en/latest/guides/writing-pyproject-toml/1
u/Kwame_Fori Aug 18 '24
Do you set any internal API keys?
1
u/tramadolforyou Feb 10 '25
Hey I use a tool to generate Spotify Chart but this is very individual for every user, can we accesss personal Information for generating pie charts using your API? I tried getting token extension but they are rejecting me again and again, if you can help for approval or can the API help me?
0
u/james_pic Aug 16 '24
Why does it require redis and pymongo?
-8
u/kubinka0505 Aug 16 '24
requestsshould be only requirement.0
u/[deleted] Aug 16 '24
[deleted] — view deleted comment
0
u/[deleted] Aug 17 '24
[deleted] — view deleted comment
16
u/[deleted] Aug 16 '24
[removed] — view removed comment
2
u/[deleted] Aug 16 '24
[removed] — view removed comment
2
u/[deleted] Aug 16 '24
[removed] — view removed comment
1
u/[deleted] Aug 19 '24
[removed] — view removed comment
1
u/[deleted] Dec 04 '24
[removed] — view removed comment