You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Under some circumastances, YT returns a playlist where "runs" is under "subtitle" and not "title".
To Reproduce
>>> from ytmusicapi.ytmusic import YTMusic
>>> y = YTMusic(None)
>>> y.get_playlist("PLZ6Ih9wLHQ2Hm2d3Cb0iV48Z2hQjGRyNz", limit=None)
The error I get is
Traceback (most recent call last):
File "/Users/fritz/work/ytm2spt/venv/lib/python3.12/site-packages/ytmusicapi/navigation.py", line 106, in nav
root = root[k]
~~~~^^^
KeyError: 'runs'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/fritz/work/ytm2spt/venv/lib/python3.12/site-packages/ytmusicapi/mixins/playlists.py", line 111, in get_playlist
return self._parse_new_playlist_format(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/fritz/work/ytm2spt/venv/lib/python3.12/site-packages/ytmusicapi/mixins/playlists.py", line 201, in _parse_new_playlist_format
playlist["title"] = nav(header, TITLE_TEXT)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/fritz/work/ytm2spt/venv/lib/python3.12/site-packages/ytmusicapi/navigation.py", line 110, in nav
raise type(e)(f"Unable to find '{k}' using path {items!r} on {root!r}, exception: {e}")
KeyError: "Unable to find 'runs' using path ['title', 'runs', 0, 'text'] on {}, exception: 'runs'"
Additional context
It could be that YT messed up on their side - for example the playlists where that happens are not listed in my user account but they are there if I access them by direct playlist id. They used to be there, and something is odd. Either way, it does happen, and ytmusicapi should be able to deal with it.
It's an easy fix and I will submit a PR
The text was updated successfully, but these errors were encountered:
gotofritz
added a commit
to gotofritz/ytmusicapi
that referenced
this issue
Oct 5, 2024
Describe the bug
Under some circumastances, YT returns a playlist where "runs" is under "subtitle" and not "title".
To Reproduce
The error I get is
Additional context
It could be that YT messed up on their side - for example the playlists where that happens are not listed in my user account but they are there if I access them by direct playlist id. They used to be there, and something is odd. Either way, it does happen, and ytmusicapi should be able to deal with it.
It's an easy fix and I will submit a PR
The text was updated successfully, but these errors were encountered: