diff --git a/tests/mixins/test_playlists.py b/tests/mixins/test_playlists.py index 907a312..485776c 100644 --- a/tests/mixins/test_playlists.py +++ b/tests/mixins/test_playlists.py @@ -54,7 +54,7 @@ class TestPlaylists: assert playlist["owned"] is False playlist = yt_oauth.get_playlist("RDATgXd-") - assert playlist["trackCount"] >= 100 + assert playlist["trackCount"] is None # playlist has no trackCount assert len(playlist["tracks"]) >= 100 playlist = yt_oauth.get_playlist("PLj4BSJLnVpNyIjbCWXWNAmybc97FXLlTk", limit=None, related=True) diff --git a/ytmusicapi/mixins/playlists.py b/ytmusicapi/mixins/playlists.py index 258f85a..84e895b 100644 --- a/ytmusicapi/mixins/playlists.py +++ b/ytmusicapi/mixins/playlists.py @@ -151,9 +151,9 @@ class PlaylistsMixin(MixinProtocol): song_count_text = second_subtitle_runs[has_views + 0]["text"] song_count_search = re.findall(r"\d+", song_count_text) # extract the digits from the text, return 0 if no match - song_count = to_int("".join(song_count_search)) if song_count_search is not None else 0 + song_count = to_int("".join(song_count_search)) if song_count_search is not None else None else: - song_count = len(section_list["contents"]) + song_count = None playlist["trackCount"] = song_count @@ -278,7 +278,7 @@ class PlaylistsMixin(MixinProtocol): :param title: Optional. New title for the playlist :param description: Optional. New description for the playlist :param privacyStatus: Optional. New privacy status for the playlist - :param moveItem: Optional. Move one item before another. Items are specified by setVideoId, which is the + :param moveItem: Optional. Move one item before another. Items are specified by setVideoId, which is the unique id of this playlist item. See :py:func:`get_playlist` :param addPlaylistId: Optional. Id of another playlist to add to this playlist :param addToTop: Optional. Change the state of this playlist to add items to the top of the playlist (if True)