Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Unable to find 'runs' using path ['title', 'runs', 0, 'text'] on {} #656

Closed
gotofritz opened this issue Oct 5, 2024 · 0 comments · Fixed by #657
Closed

"Unable to find 'runs' using path ['title', 'runs', 0, 'text'] on {} #656

gotofritz opened this issue Oct 5, 2024 · 0 comments · Fixed by #657

Comments

@gotofritz
Copy link
Contributor

gotofritz commented Oct 5, 2024

Describe the bug

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant