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

KeyError: 'runs' while fetching playlists #119

Closed
KoljaWindeler opened this issue Dec 11, 2020 · 6 comments
Closed

KeyError: 'runs' while fetching playlists #119

KoljaWindeler opened this issue Dec 11, 2020 · 6 comments

Comments

@KoljaWindeler
Copy link

KoljaWindeler commented Dec 11, 2020

hi, i'm using great api for this media_player: https://github.com/KoljaWindeler/ytube_music_player and it works great in general. a user hit the error below (https://community.home-assistant.io/t/youtube-music-media-browser/226367/129?u=jkw) any idea what happened here and how to prevent this?
thanks


  File "/config/custom_components/ytube_music_player/media_player.py", line 387, in _update_playlists
    self._playlists = self._api.get_library_playlists(limit = 99)
  File "/usr/local/lib/python3.8/site-packages/ytmusicapi/mixins/library.py", line 39, in get_library_playlists
    get_continuations(results, 'gridContinuation', limit - len(playlists),
  File "/usr/local/lib/python3.8/site-packages/ytmusicapi/parsers/utils.py", line 67, in get_continuations
    contents = get_continuation_contents(results, parse_func)
  File "/usr/local/lib/python3.8/site-packages/ytmusicapi/parsers/utils.py", line 110, in get_continuation_contents
    return parse_func(continuation[term])
  File "/usr/local/lib/python3.8/site-packages/ytmusicapi/mixins/library.py", line 37, in <lambda>
    parse_func = lambda contents: parse_content_list(contents, parse_playlist)
  File "/usr/local/lib/python3.8/site-packages/ytmusicapi/parsers/browsing.py", line 139, in parse_content_list
    contents.append(parse_func(result['musicTwoRowItemRenderer']))
  File "/usr/local/lib/python3.8/site-packages/ytmusicapi/parsers/browsing.py", line 176, in parse_playlist
    'title': nav(data, TITLE_TEXT),
  File "/usr/local/lib/python3.8/site-packages/ytmusicapi/parsers/utils.py", line 148, in nav
    raise err
  File "/usr/local/lib/python3.8/site-packages/ytmusicapi/parsers/utils.py", line 142, in nav
    root = root[k]
KeyError: 'runs'

edit another user pointed out that it is caused by empty playlists?

@sigma67
Copy link
Owner

sigma67 commented Dec 11, 2020

Unfortunately I can't reproduce it even when I create an empty playlist in my library. There must be some odd playlist in there that is causing this issue. The playlist title should never be missing.

Could you ask the users to take screenshots of any odd playlists in their library, or even better provide the response from YouTube Music when they open the library page/retrieve it with ytmusicapi? Kind of hard to tell what edge case we're running into here without more detail.

@sigma67
Copy link
Owner

sigma67 commented Dec 16, 2020

Is this issue still relevant @KoljaWindeler ? Any idea under what circumstances this is happening?

@KoljaWindeler
Copy link
Author

I guess we can close it. no feedback from the user who reported the issue and it is working fine here

@KoljaWindeler
Copy link
Author

Hi just because we might have the same case again and this time a user who is willing to help .. can you give some guidance on "or even better provide the response from YouTube Music when they open the library page/retrieve it with ytmusicapi?"

@KoljaWindeler KoljaWindeler reopened this Dec 30, 2020
@sigma67
Copy link
Owner

sigma67 commented Dec 31, 2020

Similar to when you set up ytmusicapi, open the network requests tab in your browser's developer tools. Then click on 'Library', which should fetch the playlists also. You will see a request to /browse, where you can right click -> copy -> copy response (in Firefox). The procedure is similar in Chrome.

To ensure you selected the correct request you can clear your network tab beforehand (trash icon) or search the response for the title of some of the playlists that appear on the page.

@KoljaWindeler
Copy link
Author

no feedback from user, sorry. will reopen if i get more feedback

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

No branches or pull requests

2 participants