[GH-ISSUE #551] KeyError: 'musicResponsiveListItemRenderer' When Calling get_charts with Non-Global Country Codes #389

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

Originally created by @PelicanSL on GitHub (Feb 21, 2024).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/551

Description
When using the get_charts method from ytmusicapi, specifying the global country code "ZZ" works as expected and returns chart data without issues. However, attempting to use any other country code (e.g., "ES", "US", "FR", "EN") results in a KeyError for 'musicResponsiveListItemRenderer'. This issue occurs across different country codes, suggesting a problem with handling responses for specific countries other than the global charts.

To Reproduce:
Steps to reproduce the behavior:

  1. Initialize YTMusic object.
  2. Call get_charts method with a country code other than "ZZ", e.g., yt.get_charts("ES").
  3. Observe the KeyError: 'musicResponsiveListItemRenderer'.

Expected Behavior:
The expected behavior is for the get_charts method to return chart data for the specified country without raising an error, similar to how it behaves with the global country code "ZZ".

Actual Behavior:
A KeyError is raised for 'musicResponsiveListItemRenderer', indicating a failure to parse the API response for non-global country codes.

Error Message:

Captura de pantalla 2024-02-21 a las 20 22 14

Additional Context:

  • This issue has been encountered using ytmusicapi version 1.5.2.
  • The error occurs regardless of the non-global country code used.
  • The issue seems related to the parsing of the API response for specific countries, as the global charts (country code "ZZ") work without issues.

Code Sample:

from ytmusicapi import YTMusic

yt = YTMusic()
country = "ES"  # Example country code distinct from ZZ
search_results = yt.get_charts(country)
print(search_results) 

I have the library updated to version 1.5.2, and the issue persists across various non-global country codes, indicating a broader problem with handling country-specific chart data.

Thanks!!

Originally created by @PelicanSL on GitHub (Feb 21, 2024). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/551 **Description** When using the get_charts method from ytmusicapi, specifying the global country code "ZZ" works as expected and returns chart data without issues. However, attempting to use any other country code (e.g., "ES", "US", "FR", "EN") results in a KeyError for 'musicResponsiveListItemRenderer'. This issue occurs across different country codes, suggesting a problem with handling responses for specific countries other than the global charts. **To Reproduce:** Steps to reproduce the behavior: 1. Initialize YTMusic object. 2. Call get_charts method with a country code other than "ZZ", e.g., yt.get_charts("ES"). 3. Observe the KeyError: 'musicResponsiveListItemRenderer'. **Expected Behavior:** The expected behavior is for the get_charts method to return chart data for the specified country without raising an error, similar to how it behaves with the global country code "ZZ". **Actual Behavior:** A KeyError is raised for 'musicResponsiveListItemRenderer', indicating a failure to parse the API response for non-global country codes. **Error Message:** ![Captura de pantalla 2024-02-21 a las 20 22 14](https://github.com/sigma67/ytmusicapi/assets/93591782/2655a5f8-fa13-40c4-99f7-2432e9585f86) **Additional Context:** - This issue has been encountered using ytmusicapi version 1.5.2. - The error occurs regardless of the non-global country code used. - The issue seems related to the parsing of the API response for specific countries, as the global charts (country code "ZZ") work without issues. **Code Sample:** ``` from ytmusicapi import YTMusic yt = YTMusic() country = "ES" # Example country code distinct from ZZ search_results = yt.get_charts(country) print(search_results) ``` I have the library updated to version 1.5.2, and the issue persists across various non-global country codes, indicating a broader problem with handling country-specific chart data. Thanks!!
kerem 2026-02-27 23:00:32 +03:00
  • closed this issue
  • added the
    yt-update
    label
Author
Owner

@sigma67 commented on GitHub (Feb 22, 2024):

This is hard to debug without the actual JSON data being returned for you. You can retrieve it via the POST requests when navigating to the charts page on YouTube Music.

Screenshots may help as well.

I know YouTube Music has been doing A/B tests lately on that page because I've been affected as well (the Trending category stopped showing up for a while, but now it's back).

<!-- gh-comment-id:1960157131 --> @sigma67 commented on GitHub (Feb 22, 2024): This is hard to debug without the actual JSON data being returned for you. You can retrieve it via the POST requests when navigating to the charts page on YouTube Music. Screenshots may help as well. I know YouTube Music has been doing A/B tests lately on that page because I've been affected as well (the Trending category stopped showing up for a while, but now it's back).
Author
Owner

@fischcode commented on GitHub (Feb 23, 2024):

I can confirm this issue with ytmusicapi 1.5.2.; As the issue does not appear in branch fix-548 it appears to have been caused by the modifications in ytmusic 1.5.2 which have been reverted in that branch.

<!-- gh-comment-id:1962106945 --> @fischcode commented on GitHub (Feb 23, 2024): I can confirm this issue with ytmusicapi 1.5.2.; As the issue does not appear in branch [fix-548](https://github.com/sigma67/ytmusicapi/tree/fix-548) it appears to have been caused by the modifications in ytmusic 1.5.2 which have been reverted in that branch.
Author
Owner

@sigma67 commented on GitHub (Feb 24, 2024):

@PelicanSL can you check with 1.5.3 and close if fixed?

<!-- gh-comment-id:1962306208 --> @sigma67 commented on GitHub (Feb 24, 2024): @PelicanSL can you check with 1.5.3 and close if fixed?
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#389
No description provided.