sigma67 / ytmusicapi

Unofficial API for YouTube Music
https://ytmusicapi.readthedocs.io
MIT License
1.71k stars 194 forks source link

KeyError in get_mood_playlists function #507

Closed JDFraire-P closed 8 months ago

JDFraire-P commented 9 months ago

When using the get_mood_playlists function I get the following KeyError:

>>> yt.get_mood_categories()['Genres'][23]
{'title': 'Regional Mexican', 'params': 'ggMPOg1uX2hmQXdqbHBjT3Zw'}

>>> yt.get_mood_playlists("ggMPOg1uX2hmQXdqbHBjT3Zw")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jd-fraire/.local/lib/python3.11/site-packages/ytmusicapi/mixins/explore.py", line 87, in get_mood_playlists
    playlists += parse_content_list(results, parse_playlist)
  File "/home/jd-fraire/.local/lib/python3.11/site-packages/ytmusicapi/parsers/browsing.py", line 49, in parse_content_list
    contents.append(parse_func(result[key]))
KeyError: 'musicTwoRowItemRenderer'
sigma67 commented 9 months ago

What is your location? And/or location param to YTMusic? I don't have any "Regional Mexican" genres, and can't request your param using get_mood_playlists without getting error 500

JDFraire-P commented 9 months ago

This is my YTMusic object: yt = YTMusic("JDFraire.json", location="MX")

sigma67 commented 9 months ago

I honestly don't know why that one would be any different. Can you visit the page using the web UI?

https://music.youtube.com/moods_and_genres

What does it look like?

JDFraire-P commented 9 months ago

It seems to be an internal YouTube error

IMG_20240107_161148

IMG_20240107_150756 IMG_20240107_150730