mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 16:15:51 +03:00
[GH-ISSUE #878] Anonymous access to API #537
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#537
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dieser-niko on GitHub (Nov 2, 2022).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/878
Is your feature request related to a problem? Please describe.
This feature would allow the script to make anonymous API calls without login or registered application.
Describe the solution you'd like
It's actually very easy to obtain an anonymous token: https://open.spotify.com/get_access_token
I wrote a little script, but it may not be the best implementation (basically copied SpotifyClientCredentials and changed the class to my liking):
spotipy_anon.py
main.py
Describe alternatives you've considered
None.
Additional context
Not really relevant for this suggestion or even for this repo, but there's also the endpoint
api-partner.spotify.comwhich uses the same token, but much harder to implement. This is how I found the anonymous token. It is possible to get even more stuff like background colors and things relevant to the front end, but you need the hash of the definition, which can be changed (and was already changed while I was testing it)@stephanebruckert commented on GitHub (Nov 2, 2022):
Really cool discovery. It's not part of the public/documented API so we will want to think of whether/how we could incorporate this into spotipy. The API has a lot of other hidden/private endpoints, for example getting/setting the user playlists order https://github.com/mirrorfm/spotify-private-api. The problem is they could change without warning and versioning could become difficult. But definitely something to explore more.
@dieser-niko commented on GitHub (Nov 2, 2022):
That's true. After researching for a little bit, the only "official" thing I could find was an issue in the old spotify web api repo. So at least it looks like they are aware that people use it.
A quick look into the WaybackMachine also reveals that it didn't change for the last 2 1/2 years when it first appeared, but I don't think it matters that much.
If you think the risk is too high that it will change again, then I would suggest mentioning this endpoint and/or class in the documentation.
@danihodovic commented on GitHub (Apr 7, 2023):
Great find. I'd love to see this merged so I don't have to create a developer app and inject environment variables for smaller projects.
@dieser-niko commented on GitHub (Apr 7, 2023):
As stephanebruckert already mentioned, this isn't part of the public API, I don't think, it will be included in spotipy at all. So you still have to copy the python script yourself in order to use it.
@nleroy917 commented on GitHub (May 5, 2023):
You could just make a separate, very tiny,
spotipy-anonpackage that people can optionally install that does this for them and just interfaces with the core ofspotipy. Then its implemented just like your example:@dieser-niko commented on GitHub (May 9, 2023):
Well then, first ever release.
spotipy-anon is now available on PyPI and GitHub.
I guess this is now finished, closing the issue.
@nleroy917 commented on GitHub (May 9, 2023):
Cool! Would love to contribute if needed!
@dieser-niko commented on GitHub (May 15, 2023):
Help is always appreciated, but this is a relatively small repository, so I'm not sure where you can contribute. At the moment, I only have one open (self made) issue, which is about testing the endpoints. I wanted to do this myself, but you can try it too if you like.
@dieser-niko commented on GitHub (Jul 25, 2023):
I just want to add this little bit here because it is related. According to the ToS in section IV 2.b.i. it is forbidden to provide unauthorised access to a Spotify service.
Even though this library does not require a registered application, it still uses the API service and, if I understand correctly, has to obey the ToS. So basically use it at your own risk, I won't take it down unless Spotify notices.
I actually stumbled across this when I finished reverse engineering the api-partner.spotify.com endpoint (which, surprise, is also against the ToS). So, sadly, I probably won't be publishing my findings.