Skip to content

get_sha256_hash broken due to Spotify CDN URL format change (404 errors) #53

@simonebartoli

Description

@simonebartoli

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),
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions