mirror of
https://github.com/sigma67/ytmusicapi.git
synced 2026-04-25 15:26:01 +03:00
[GH-ISSUE #587] KeyError: "Unable to find 'menu' using path #407
Labels
No labels
a/b
bug
documentation
enhancement
good first issue
help wanted
invalid
pull-request
question
wontfix
yt-error
yt-update
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ytmusicapi#407
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ClintGreen5150 on GitHub (May 23, 2024).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/587
I am very new to this so I apologize if I'm doing this wrong...
I'm trying to create playlists of a few thousand tracks but I keep hitting this keyerror. It's completely intermittent, occurs on a different track each time. I am using the search function to find an album, grabbing the albumID and using that to browse to the album, then selecting a random track and using its ID to add it to the playlist. This seems to happen around the 200 track mark but it has also happened after adding about 80 tracks in this manner.
I've tried batching the artist/album data to chunks of 100 but the issue persists.
To Reproduce
Steps to reproduce the behavior:
I really am not sure unfortunately, it is intermittent, it just happens on a random track when trying to add to a playlist.
Additional context
Using the latest version, 1.7.2
@sigma67 commented on GitHub (May 23, 2024):
Hi, thanks for the report.
Please provide the full stack trace and error message, including the search term you used.
@ClintGreen5150 commented on GitHub (May 23, 2024):
I hope this is correct and what you are looking for - I am still learning code, 2 months in :)
Search results for blackened entrails - manifesto sepulcral:
[{'title': 'manifesto sepulcral', 'artist': 'blackened entrails', 'browseId': 'MPREb_RME6sh1SHeK', 'resultType': 'album'}]
Traceback (most recent call last):
File "c:\Users\User\PycharmProjects\YT-Music-Playlist-Generator.conda\Lib\site-packages\ytmusicapi\navigation.py", line 106, in nav
root = root[k]
~~~~^^^
KeyError: 'menu'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\User\PycharmProjects\YT-Music-Playlist-Generator\YT_playlist_gen.py", line 127, in
search_results = yt.search(search_query)
^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\User\PycharmProjects\YT-Music-Playlist-Generator.conda\Lib\site-packages\ytmusicapi\mixins\search.py", line 236, in search
parse_search_results(shelf_contents, search_result_types, result_type, category)
File "c:\Users\User\PycharmProjects\YT-Music-Playlist-Generator.conda\Lib\site-packages\ytmusicapi\parsers\search.py", line 178, in parse_search_results
parse_search_result(result[MRLIR], search_result_types, resultType, category) for result in results
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\User\PycharmProjects\YT-Music-Playlist-Generator.conda\Lib\site-packages\ytmusicapi\parsers\search.py", line 91, in parse_search_result
parse_menu_playlists(data, search_result)
File "c:\Users\User\PycharmProjects\YT-Music-Playlist-Generator.conda\Lib\site-packages\ytmusicapi\parsers_utils.py", line 7, in parse_menu_playlists
watch_menu = find_objects_by_key(nav(data, MENU_ITEMS), MNIR)
^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\User\PycharmProjects\YT-Music-Playlist-Generator.conda\Lib\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 'menu' using path ['menu', 'menuRenderer', 'items'] on {'trackingParams': 'CBAQyfQCGAAiEwi9rbHTwqSGAxWJyEkHHdMEDDM=', 'thumbnail': {'musicThumbnailRenderer': {'thumbnail':
{}, 'thumbnailCrop': 'MUSIC_THUMBNAIL_CROP_CIRCLE', 'thumbnailScale': 'MUSIC_THUMBNAIL_SCALE_ASPECT_FILL', 'trackingParams': 'CBEQhL8CIhMIva2x08KkhgMVichJBx3TBAwz'}}, 'flexColumns': [{'musicResponsiveListItemFlexColumnRenderer': {'text': {'runs': [{'text': 'Jianxin Li'}]}, 'displayPriority': 'MUSIC_RESPONSIVE_LIST_ITEM_COLUMN_DISPLAY_PRIORITY_HIGH'}}, {'musicResponsiveListItemFlexColumnRenderer': {'text': {'runs': [{'text': 'Profile'}]}, 'displayPriority': 'MUSIC_RESPONSIVE_LIST_ITEM_COLUMN_DISPLAY_PRIORITY_HIGH'}}], 'flexColumnDisplayStyle': 'MUSIC_RESPONSIVE_LIST_ITEM_FLEX_COLUMN_DISPLAY_STYLE_TWO_LINE_STACK', 'navigationEndpoint': {'clickTrackingParams': 'CBAQyfQCGAAiEwi9rbHTwqSGAxWJyEkHHdMEDDM=', 'browseEndpoint': {'browseId': 'UC_usPjyxDU93yOVnY32_b_Q', 'browseEndpointContextSupportedConfigs': {'browseEndpointContextMusicConfig': {'pageType': 'MUSIC_PAGE_TYPE_UNKNOWN'}}}}, 'itemHeight': 'MUSIC_RESPONSIVE_LIST_ITEM_HEIGHT_TALL'}, exception: 'menu'"
@sigma67 commented on GitHub (May 25, 2024):
@ClintGreen5150 please check if the linked PR fixes it
ytmusic.get_library_upload_songs(...)#610