[GH-ISSUE #53] get_sha256_hash broken due to Spotify CDN URL format change (404 errors) #31

Closed
opened 2026-02-27 19:06:32 +03:00 by kerem · 1 comment
Owner

Originally created by @simonebartoli on GitHub (Dec 14, 2025).
Original GitHub issue: https://github.com/Aran404/SpotAPI/issues/53

The function get_sha256_hash in spotapi/client.py is currently broken. All attempts to retrieve query hashes (artists, playlists, tracks) fail with HTTP 404. get_sha256_hash always fails, making artist/playlist/song queries unusable.

Root cause:
Spotify changed the structure of their CDN URLs by inverting the order of str_mapping and hash_mapping used to build the web-player asset paths.

Current code (broken):

urls = map(
    lambda s: f"https://open.spotifycdn.com/cdn/build/web-player/{s}",
    combine_chunks(str_mapping, hash_mapping),
)

Fixed code:

urls = map(
    lambda s: f"https://open.spotifycdn.com/cdn/build/web-player/{s}",
    combine_chunks(hash_mapping, str_mapping),
)
Originally created by @simonebartoli on GitHub (Dec 14, 2025). Original GitHub issue: https://github.com/Aran404/SpotAPI/issues/53 The function `get_sha256_hash` in `spotapi/client.py` is currently broken. All attempts to retrieve query hashes (artists, playlists, tracks) fail with HTTP 404. `get_sha256_hash` always fails, making artist/playlist/song queries unusable. **Root cause:** Spotify changed the structure of their CDN URLs by inverting the order of `str_mapping` and `hash_mapping` used to build the web-player asset paths. **Current code (broken):** ```python urls = map( lambda s: f"https://open.spotifycdn.com/cdn/build/web-player/{s}", combine_chunks(str_mapping, hash_mapping), ) ``` **Fixed code:** ```python urls = map( lambda s: f"https://open.spotifycdn.com/cdn/build/web-player/{s}", combine_chunks(hash_mapping, str_mapping), ) ```
kerem closed this issue 2026-02-27 19:06:32 +03:00
Author
Owner

@Aran404 commented on GitHub (Dec 14, 2025):

Thank you very much, haven't looked at this in a while

<!-- gh-comment-id:3651530593 --> @Aran404 commented on GitHub (Dec 14, 2025): Thank you very much, haven't looked at this in a while
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SpotAPI#31
No description provided.