sigma67/ytmusicapi

get_history throwing KeyError: 'menuServiceItemRenderer'

Closed this issue · 1 comments

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