From 267fd32898812e9fbf311fdec4ce0e7fbe91741d Mon Sep 17 00:00:00 2001 From: vveeps <54472340+vveeps@users.noreply.github.com> Date: Thu, 11 Nov 2021 16:52:31 +0200 Subject: [PATCH] ignore playlist items with track: null --- pomice/spotify/client.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pomice/spotify/client.py b/pomice/spotify/client.py index ba517f5..c0b1572 100644 --- a/pomice/spotify/client.py +++ b/pomice/spotify/client.py @@ -75,7 +75,10 @@ class Client: elif spotify_type == "album": return Album(data) else: - tracks = [Track(track["track"]) for track in data["tracks"]["items"]] + tracks = [ + Track(track["track"]) + for track in data["tracks"]["items"] if track["track"] is not None + ] next_page_url = data["tracks"]["next"] while next_page_url is not None: @@ -87,7 +90,10 @@ class Client: next_data: dict = await resp.json() - tracks += [Track(track["track"]) for track in next_data["items"]] + tracks += [ + Track(track["track"]) + for track in next_data["items"] if track["track"] is not None + ] next_page_url = next_data["next"] return Playlist(data, tracks)