[GH-ISSUE #690] get_history throwing KeyError: 'menuServiceItemRenderer' #455

Closed
opened 2026-02-27 23:00:53 +03:00 by kerem · 1 comment
Owner

Originally created by @dkelley93 on GitHub (Dec 16, 2024).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/690

Describe the bug
The get_history function is throwing KeyError: 'menuServiceItemRenderer'.

To Reproduce

Sample code to reproduce:

from ytmusicapi import YTMusic

yt = YTMusic("browser.json")
print(yt.get_history())

Additional context

Traceback (most recent call last):
File "/Users/REDACTED/sources/git/YTMusic/.venv/lib/python3.9/site-packages/ytmusicapi/navigation.py", line 107, in nav
root = root[k]
KeyError: 'menuServiceItemRenderer'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/REDACTED/sources/git/YTMusic/main.py", line 4, in
print(yt.get_history())
File "/Users/REDACTED/sources/git/YTMusic/.venv/lib/python3.9/site-packages/ytmusicapi/mixins/library.py", line 303, in get_history
songlist = parse_playlist_items(data, menu_entries)
File "/Users/REDACTED/sources/git/YTMusic/.venv/lib/python3.9/site-packages/ytmusicapi/parsers/playlists.py", line 70, in parse_playlist_items
song = parse_playlist_item(data, menu_entries, is_album)
File "/Users/REDACTED/sources/git/YTMusic/.venv/lib/python3.9/site-packages/ytmusicapi/parsers/playlists.py", line 217, in parse_playlist_item
song[menu_entry[-1]] = nav(data, MENU_ITEMS + menu_entry)
File "/Users/REDACTED/sources/git/YTMusic/.venv/lib/python3.9/site-packages/ytmusicapi/navigation.py", line 111, in nav
raise type(e)(f"Unable to find '{k}' using path {items!r} on {root!r}, exception: {e}")
KeyError: "Unable to find 'menuServiceItemRenderer' using path ['menu', 'menuRenderer', 'items', -1, 'menuServiceItemRenderer', 'serviceEndpoint', 'feedbackEndpoint', 'feedbackToken'] on {'toggleMenuServiceItemRenderer': {'defaultText': {'runs': [{'text': 'Pin to Listen again'}]}, 'defaultIcon': {'iconType': 'KEEP'}, 'defaultServiceEndpoint': {'clickTrackingParams': 'CMEdEP7eChgLIhMIw_30wNSsigMVGOFyCR0GvDgh', 'feedbackEndpoint': {'feedbackToken': 'AB9zfpL-tKVso2d5846RkJZtNAMAi5StNXJpUmratMfXbyb7gUfhd7gYS6_ZdSjutdNB8RUl_T68g0ds9N5bBpuarNrgB1RSgIV7uqFHO-wy2HWAuov-ChA'}}, 'toggledText': {'runs': [{'text': 'Unpin from Listen again'}]}, 'toggledIcon': {'iconType': 'KEEP_OFF'}, 'toggledServiceEndpoint': {'clickTrackingParams': 'CMEdEP7eChgLIhMIw_30wNSsigMVGOFyCR0GvDgh', 'feedbackEndpoint': {'feedbackToken': 'AB9zfpIB64DWivCn1O17zn5VuDhxtct1rEe1FK7WM-OG8O3iBJIWr-QipE1gz9LAiEUivK-NIiObhEoRelscOYiaxZGrjoNFBXQAZtVRsDPFbmfYR8IPxRA'}}, 'trackingParams': 'CMEdEP7eChgLIhMIw_30wNSsigMVGOFyCR0GvDgh'}}, exception: 'menuServiceItemRenderer'"

Process finished with exit code 1

Python Version: 3.9
ytmusicapi Version: 1.82

Originally created by @dkelley93 on GitHub (Dec 16, 2024). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/690 **Describe the bug** The get_history function is throwing KeyError: 'menuServiceItemRenderer'. **To Reproduce** Sample code to reproduce: ```python from ytmusicapi import YTMusic yt = YTMusic("browser.json") print(yt.get_history()) ``` **Additional context** > Traceback (most recent call last): > File "/Users/REDACTED/sources/git/YTMusic/.venv/lib/python3.9/site-packages/ytmusicapi/navigation.py", line 107, in nav > root = root[k] > KeyError: 'menuServiceItemRenderer' > > During handling of the above exception, another exception occurred: > > Traceback (most recent call last): > File "/Users/REDACTED/sources/git/YTMusic/main.py", line 4, in <module> > print(yt.get_history()) > File "/Users/REDACTED/sources/git/YTMusic/.venv/lib/python3.9/site-packages/ytmusicapi/mixins/library.py", line 303, in get_history > songlist = parse_playlist_items(data, menu_entries) > File "/Users/REDACTED/sources/git/YTMusic/.venv/lib/python3.9/site-packages/ytmusicapi/parsers/playlists.py", line 70, in parse_playlist_items > song = parse_playlist_item(data, menu_entries, is_album) > File "/Users/REDACTED/sources/git/YTMusic/.venv/lib/python3.9/site-packages/ytmusicapi/parsers/playlists.py", line 217, in parse_playlist_item > song[menu_entry[-1]] = nav(data, MENU_ITEMS + menu_entry) > File "/Users/REDACTED/sources/git/YTMusic/.venv/lib/python3.9/site-packages/ytmusicapi/navigation.py", line 111, in nav > raise type(e)(f"Unable to find '{k}' using path {items!r} on {root!r}, exception: {e}") > KeyError: "Unable to find 'menuServiceItemRenderer' using path ['menu', 'menuRenderer', 'items', -1, 'menuServiceItemRenderer', 'serviceEndpoint', 'feedbackEndpoint', 'feedbackToken'] on {'toggleMenuServiceItemRenderer': {'defaultText': {'runs': [{'text': 'Pin to Listen again'}]}, 'defaultIcon': {'iconType': 'KEEP'}, 'defaultServiceEndpoint': {'clickTrackingParams': 'CMEdEP7eChgLIhMIw_30wNSsigMVGOFyCR0GvDgh', 'feedbackEndpoint': {'feedbackToken': 'AB9zfpL-tKVso2d5846RkJZtNAMAi5StNXJpUmratMfXbyb7gUfhd7gYS6_ZdSjutdNB8RUl_T68g0ds9N5bBpuarNrgB1RSgIV7uqFHO-wy2HWAuov-ChA'}}, 'toggledText': {'runs': [{'text': 'Unpin from Listen again'}]}, 'toggledIcon': {'iconType': 'KEEP_OFF'}, 'toggledServiceEndpoint': {'clickTrackingParams': 'CMEdEP7eChgLIhMIw_30wNSsigMVGOFyCR0GvDgh', 'feedbackEndpoint': {'feedbackToken': 'AB9zfpIB64DWivCn1O17zn5VuDhxtct1rEe1FK7WM-OG8O3iBJIWr-QipE1gz9LAiEUivK-NIiObhEoRelscOYiaxZGrjoNFBXQAZtVRsDPFbmfYR8IPxRA'}}, 'trackingParams': 'CMEdEP7eChgLIhMIw_30wNSsigMVGOFyCR0GvDgh'}}, exception: 'menuServiceItemRenderer'" > > Process finished with exit code 1 Python Version: 3.9 ytmusicapi Version: 1.82
kerem closed this issue 2026-02-27 23:00:53 +03:00
Author
Owner

@sigma67 commented on GitHub (Dec 16, 2024):

#687

<!-- gh-comment-id:2546501354 --> @sigma67 commented on GitHub (Dec 16, 2024): #687
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ytmusicapi#455
No description provided.