spotipy: Offset field not working for user_playlist_tracks(), wrong response back

I’m getting an odd issue where I’m not retrieving the response that I’m expecting when calling user_playlist_tracks() to retrieve tracks from a playlist. I still retrieve the songs, but the paging object I receive back is incorrect, which is also preventing the ‘limit’ and ‘offset’ field from being set correctly, since they are now located in the ‘track’ object that gets returned.

According to the spotify docs: https://developer.spotify.com/documentation/web-api/reference/playlists/get-playlists-tracks/

I should be receiving a paging object like such:

{
  "href": "",
  "items": [ ],
  "limit": 0,
  "next": "",
  "offset": 0,
  "previous": "",
  "total" 0
}

Instead, I am receiving this:

{ 
  "collaborative": False,
  "description": "",
  "external_urls": {},
  "followers": {},
  "href": "",
  "id": "",
  "images": [],
  "name": "",
  "owner": {},
  "primary_color": null,
  "public": False
  "snapshot_id": "",
  "tracks": {},
  "type": "",
  "uri": "",
  "len": 0
}

Where the tracks object contains the paging object that I am actually expecting according to the Spotify docs above.

I am aware that this used to work properly since I have previously implemented code to retrieve all the tracks from my playlists, but for some reason, the response I’m getting back now with identical code is different. I’m not sure if this is something that has changed on Spotipy’s end or the Spotify API.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 22 (11 by maintainers)

Most upvoted comments

@stephanebruckert nice! You’re a legend haha. Thanks a ton

I mean when I was calling with fields=‘tracks’, I was receiving an object containing tracks:

{
    "tracks": { all tracks content here }
}

Weird, but anyways I can finally say this is solved