From c93f66471c68867ed82d1d3807711a87cd02cf24 Mon Sep 17 00:00:00 2001 From: sigma67 Date: Wed, 28 Oct 2020 20:24:08 +0100 Subject: [PATCH] remove_playlist_items: remove invalid items from list (closes #88) --- ytmusicapi/mixins/playlists.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ytmusicapi/mixins/playlists.py b/ytmusicapi/mixins/playlists.py index 271983d..112931f 100644 --- a/ytmusicapi/mixins/playlists.py +++ b/ytmusicapi/mixins/playlists.py @@ -252,7 +252,8 @@ class PlaylistsMixin: :return: Status String or full response """ self._check_auth() - if not videos[0]['setVideoId']: + videos = list(filter(lambda x: 'videoId' in x and 'setVideoId' in x, videos)) + if len(videos) == 0: raise Exception( "Cannot remove songs, because setVideoId is missing. Do you own this playlist?")