[GH-ISSUE #507] KeyError in get_mood_playlists function #372

Closed
opened 2026-02-27 23:00:26 +03:00 by kerem · 4 comments
Owner

Originally created by @JDFraire-P on GitHub (Jan 6, 2024).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/507

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'

Originally created by @JDFraire-P on GitHub (Jan 6, 2024). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/507 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' ```
kerem 2026-02-27 23:00:26 +03:00
Author
Owner

@sigma67 commented on GitHub (Jan 6, 2024):

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

<!-- gh-comment-id:1879795809 --> @sigma67 commented on GitHub (Jan 6, 2024): 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
Author
Owner

@JDFraire-P commented on GitHub (Jan 6, 2024):

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

<!-- gh-comment-id:1879835796 --> @JDFraire-P commented on GitHub (Jan 6, 2024): This is my YTMusic object: `yt = YTMusic("JDFraire.json", location="MX")`
Author
Owner

@sigma67 commented on GitHub (Jan 7, 2024):

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?

<!-- gh-comment-id:1880004647 --> @sigma67 commented on GitHub (Jan 7, 2024): 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?
Author
Owner

@JDFraire-P commented on GitHub (Jan 7, 2024):

It seems to be an internal YouTube error

IMG_20240107_161148

IMG_20240107_150756
IMG_20240107_150730

<!-- gh-comment-id:1880208900 --> @JDFraire-P commented on GitHub (Jan 7, 2024): It seems to be an internal YouTube error ![IMG_20240107_161148](https://github.com/sigma67/ytmusicapi/assets/78577166/c4d0cdff-8820-4cf0-9aac-1d197ec1bd8c) ![IMG_20240107_150756](https://github.com/sigma67/ytmusicapi/assets/78577166/038b8883-28bb-46c2-89fc-673347ed1b31) ![IMG_20240107_150730](https://github.com/sigma67/ytmusicapi/assets/78577166/86f48476-d130-41b6-9c95-778dbbdd12b1)
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#372
No description provided.