Skip to content

get_playlist method fails for some playlists #892

Description

@mayty
  • I confirm that I have read the FAQ

Describe the bug

get_playlist method fails for some playlists with KeyError.

ytmusicapi version

1.11.5

To Reproduce

The following code:

from ytmusicapi import YTMusic

YTMusic().get_playlist('PL8eCD0llEGnywNAITfRGFiCCNpmaHc1_l')

Results in the traceback:

Traceback (most recent call last):
  ...
    YTMusic().get_playlist('PL8eCD0llEGnywNAITfRGFiCCNpmaHc1_l')
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.14/site-packages/ytmusicapi/mixins/playlists.py", line 170, in get_playlist
    playlist.update(parse_playlist_header_meta(header))
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "/app/.venv/lib/python3.14/site-packages/ytmusicapi/parsers/playlists.py", line 77, in parse_playlist_header_meta
    if "runs" in header["secondSubtitle"]:
                 ~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'secondSubtitle'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions