Skip to content

fix: switch CDN audio resolution from api.spotify.com to spclient#722

Open
grenaad wants to merge 1 commit intojpochyla:mainfrom
grenaad:feat/spclient-cdn
Open

fix: switch CDN audio resolution from api.spotify.com to spclient#722
grenaad wants to merge 1 commit intojpochyla:mainfrom
grenaad:feat/spclient-cdn

Conversation

@grenaad
Copy link

@grenaad grenaad commented Mar 2, 2026

Disclosure

All code is generated with Opencode with Opus model. I tested this with my own client id, and auth is working. I have not used Rust in a few years, so I can't verify that the code quality is up to standard. I am happy to make any changes requested.

Summary

Spotify started returning 429 (Too Many Requests) for requests to api.spotify.com/v1/storage-resolve. This switches audio file URL resolution to Spotify's spclient infrastructure, matching librespot's approach.
Inspired by ncspot commit 6769b7b. Split from #720 per review feedback — Web API Client ID changes will follow in a subsequent PR.

Changes

  • Add Transport::resolve_spclient() to discover spclient access points via apresolve.spotify.com/?type=spclient
  • Cdn::resolve_audio_file_url() now uses https://{spclient}/storage-resolve/... instead of api.spotify.com/v1/storage-resolve
  • Parse protobuf StorageResolveResponse instead of JSON
  • Send client-token header required by spclient endpoint
  • Share Arc<ClientTokenProvider> between Login5 and Cdn to avoid redundant round-trips
  • Cache resolved spclient base URL for the Cdn instance lifetime

Resolves audio file URLs via spclient (storage-resolve protobuf endpoint)
instead of the rate-limited api.spotify.com JSON endpoint. This matches
librespot's approach and avoids 429 rate-limiting on playback.

- Add Transport::resolve_spclient() for AP resolver spclient discovery
- Parse StorageResolveResponse protobuf instead of JSON
- Send client-token header required by spclient
- Share ClientTokenProvider (via Arc) between Cdn and Login5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant