From 97c9917a024022023ef574349b408e85e8e12e65 Mon Sep 17 00:00:00 2001 From: Jack Dane Date: Tue, 2 Jan 2024 14:06:18 +0000 Subject: [PATCH] Use the playlist_items function to retrieve tracks. * It will request the same endpoint as sp.next with the same fields for consistency. --- CHANGELOG.md | 1 + examples/user_playlists_contents.py | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0601ddf..34c1b41f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Changes the YouTube video link for authentication tutorial (the old video was in low definition, the new one is in high definition) - Updated links to Spotify in documentation - Improve usability on README.md +- Fix `user_playlists_contents` example. ## [2.23.0] - 2023-04-07 diff --git a/examples/user_playlists_contents.py b/examples/user_playlists_contents.py index 13b576f5..9379a0b8 100644 --- a/examples/user_playlists_contents.py +++ b/examples/user_playlists_contents.py @@ -25,8 +25,7 @@ def show_tracks(results): print(playlist['name']) print(' total tracks', playlist['tracks']['total']) - results = sp.playlist(playlist['id'], fields="tracks,next") - tracks = results['tracks'] + tracks = sp.playlist_items(playlist['id'], fields="items,next", additional_types=('tracks', )) show_tracks(tracks) while tracks['next']: