Skip to content

fix: handle Spotify February 2026 API breaking changes for playlist i…#2636

Open
dksheets wants to merge 3 commits intospotDL:masterfrom
dksheets:fix/spotify-february-2026-api-changes
Open

fix: handle Spotify February 2026 API breaking changes for playlist i…#2636
dksheets wants to merge 3 commits intospotDL:masterfrom
dksheets:fix/spotify-february-2026-api-changes

Conversation

@dksheets
Copy link
Copy Markdown

@dksheets dksheets commented Apr 1, 2026

Description

Fixes six breaking changes introduced by Spotify's February 2026 API update that prevent spotDL from downloading playlists and individual tracks.

playlist.py

  1. The playlist item response now uses item instead of track as the key for track metadata. Updated parsing to check for item first, falling back to track for backward compatibility.

song.py

  1. The genres field was removed from album and artist metadata responses. Updated to use .get() with empty list fallback instead of direct key access.
  2. The label/publisher field was removed from album metadata responses. Updated to use .get() instead of direct key access.
  3. The popularity field was removed from track metadata responses, causing a KeyError: 'popularity' on every track. Updated to use .get("popularity") instead of direct key access.
  4. The popularity field used for embedded metadata was still using direct key access, causing a crash when writing track metadata. Updated to use .get() for compatibility.

album.py

  1. The label/publisher field was removed from album metadata responses. Updated to use .get() instead of direct key access.

Related Issue

Spotify February 2026 API changelog: https://developer.spotify.com/documentation/web-api/references/changes/february-2026

Motivation and Context

  • Playlist downloads fail silently with "Found 0 songs" because track.get("track") now returns None for every item
  • Individual track downloads crash with KeyError: 'genres' since the field no longer exists in album/artist responses
  • Embedded metadata writes crash with KeyError: 'popularity' when the field is missing from the API response

How Has This Been Tested?

  • Added unit tests mocking both new (item) and legacy (track) API response formats
  • Added unit tests for missing and present genres fields
  • Verified against Spotify Web API directly using user auth tokens on macOS with spotDL 4.4.3 and Python 3.13

Screenshots (if appropriate)

N/A

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the CONTRIBUTING document
  • I have added tests to cover my changes
  • All new and existing tests passed

@Crateros
Copy link
Copy Markdown

Crateros commented Apr 2, 2026

This seems straightforward - anything we can do to help get this merged?

@dksheets
Copy link
Copy Markdown
Author

dksheets commented Apr 6, 2026

There's actually one other small change I need to make to avoid errors related to embedding track metadata with ffmpeg- I will get that up today. @Crateros I'm not sure, I'm new here 🤷

Use .get() for popularity to avoid KeyError when the field is absent
in the updated Spotify API response.
@dksheets
Copy link
Copy Markdown
Author

dksheets commented Apr 6, 2026

All changes are now included and should be ready to merge with approval

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.

2 participants