mirror of
https://github.com/Aran404/SpotAPI.git
synced 2026-04-25 16:55:50 +03:00
[GH-ISSUE #21] ValueError: Substring "accessToken":" not found in JSON string #15
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/SpotAPI#15
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 @invzfnc on GitHub (Mar 10, 2025).
Original GitHub issue: https://github.com/Aran404/SpotAPI/issues/21
Version
spotapi==1.1.4Code to reproduce the error
Result: yields
ValueErrorExpected behavior
playlist_infoshould return playlist details without errors.@TheNooB2706 commented on GitHub (Mar 11, 2025):
It seems that Spotify had changed on their side that the access token is no longer included in the initial response, but has to be requested separately from
https://open.spotify.com/get_access_token. The URL seems accessible without any specific request header that you can visit it directly on a browser, in that case maybe the initial request tohttps://open.spotify.comcan be dropped entirely replaced with this in the get_session method, but I am not very sure.github.com/Aran404/SpotAPI@059064565d/spotapi/client.py (L66-L86)@invzfnc commented on GitHub (Mar 11, 2025):
You're right about this. I tried sending a simple request to
https://open.spotify.com/get_access_tokenand haveparse_json_stringparse the response text instead.playlist_infois working with this change. But I'm unsure about the compatibility with other functions in the library, I might need the owner's opinion on this, also should I open a PR for this?@TheNooB2706 commented on GitHub (Mar 11, 2025):
Maybe you can open a PR first and see what the owner have to say. I wasn't actually using this library, just searching around to see if there's any solution available because my own code is facing the same problem and stumbled upon this.
If really want to follow what the Spotify web app is doing, the request to
https://open.spotify.com/get_access_tokenis accompanied with URL parameters ofreason=initandproductType=web-playerand request headerCookieofsp_t=<correlationId>; sp_landing=https%3A%2F%2Fopen.spotify.com%2F%3Fsp_cid%3D<correlationId>%26device%3Ddesktop, assuming these are not automatically added to every request. At least this is how it behave on my system. And I assume the other things are not important.@Aran404 commented on GitHub (Mar 11, 2025):
Should be fixed now, let me know if it works properly. Thank you for bringing issue to the surface.
@afkarxyz commented on GitHub (Mar 11, 2025):
What browser are you using?
@scottsisco commented on GitHub (Mar 12, 2025):
I just pulled the newest version of SpotAPI using pip and I can confirm the issue has been fixed for me.
@invzfnc commented on GitHub (Mar 12, 2025):
It works perfectly. Thank you! I'm closing the issue now.