[GH-ISSUE #236] Error when using YTMusic.get_charts with authenticated user #185

Closed
opened 2026-02-27 22:08:29 +03:00 by kerem · 8 comments
Owner

Originally created by @BruceZhang1993 on GitHub (Nov 26, 2021).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/236

Step to reproduce

api = YTMusic(HEADER_FILE)
api.get_charts('US')

Error info:

Traceback (most recent call last):
File "/home/bruce/Projects/Python/feeluown-ytmusic/feeluown_ytmusic/service.py", line 84, in
print(json.dumps(service.get_charts()))
File "/home/bruce/Projects/Python/feeluown-ytmusic/feeluown_ytmusic/service.py", line 77, in get_charts
return self.api.get_charts(country)
File "/home/bruce/Projects/Python/feeluown-ytmusic/.venv/lib/python3.9/site-packages/ytmusicapi/mixins/explore.py", line 235, in get_charts
'playlist': nav(results[1 + i], CAROUSEL + CAROUSEL_TITLE + NAVIGATION_BROWSE_ID,
IndexError: list index out of range

Originally created by @BruceZhang1993 on GitHub (Nov 26, 2021). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/236 Step to reproduce ```python api = YTMusic(HEADER_FILE) api.get_charts('US') ``` Error info: Traceback (most recent call last): File "/home/bruce/Projects/Python/feeluown-ytmusic/feeluown_ytmusic/service.py", line 84, in <module> print(json.dumps(service.get_charts())) File "/home/bruce/Projects/Python/feeluown-ytmusic/feeluown_ytmusic/service.py", line 77, in get_charts return self.api.get_charts(country) File "/home/bruce/Projects/Python/feeluown-ytmusic/.venv/lib/python3.9/site-packages/ytmusicapi/mixins/explore.py", line 235, in get_charts 'playlist': nav(results[1 + i], CAROUSEL + CAROUSEL_TITLE + NAVIGATION_BROWSE_ID, IndexError: list index out of range
kerem closed this issue 2026-02-27 22:08:29 +03:00
Author
Owner

@sigma67 commented on GitHub (Nov 28, 2021):

Hm, the same call works fine for me. I'm suspecting some kind of YouTube update. Can you go to the charts page and screenshot it for me to compare? Or even better, provide a JSON of the response after navigating to the US filtered page? See screenshot.

image

<!-- gh-comment-id:981092817 --> @sigma67 commented on GitHub (Nov 28, 2021): Hm, the same call works fine for me. I'm suspecting some kind of YouTube update. Can you go to the charts page and screenshot it for me to compare? Or even better, provide a JSON of the response after navigating to the US filtered page? See screenshot. ![image](https://user-images.githubusercontent.com/16363825/143771586-5b878e73-0da5-4160-99ee-7ee9cc91dff6.png)
Author
Owner

@BruceZhang1993 commented on GitHub (Nov 29, 2021):

@sigma67

Here is full JSON from the result of _send_request
https://fars.ee/DTCT

Here is full JSON from YouTube Music webpage
http://r.fars.ee/smbj

<!-- gh-comment-id:981352867 --> @BruceZhang1993 commented on GitHub (Nov 29, 2021): @sigma67 Here is full JSON from the result of _send_request https://fars.ee/DTCT Here is full JSON from YouTube Music webpage http://r.fars.ee/smbj
Author
Owner

@sigma67 commented on GitHub (Dec 1, 2021):

You are missing the "Top songs" category, which is very unusual. Do you have any idea why that is missing for you?

<!-- gh-comment-id:983398939 --> @sigma67 commented on GitHub (Dec 1, 2021): You are missing the "Top songs" category, which is very unusual. Do you have any idea why that is missing for you?
Author
Owner

@BruceZhang1993 commented on GitHub (Dec 1, 2021):

totally have no idea why. is it only for my youtube account ?

<!-- gh-comment-id:983448396 --> @BruceZhang1993 commented on GitHub (Dec 1, 2021): totally have no idea why. is it only for my youtube account ?
Author
Owner

@sigma67 commented on GitHub (Dec 1, 2021):

Not sure, what happens when you access the site while logged out? This is what you should see normally:

image

<!-- gh-comment-id:983458931 --> @sigma67 commented on GitHub (Dec 1, 2021): Not sure, what happens when you access the site while logged out? This is what you should see normally: ![image](https://user-images.githubusercontent.com/16363825/144209606-9afffa61-c76d-463e-8e93-1b42c20b12a4.png)
Author
Owner

@BruceZhang1993 commented on GitHub (Dec 1, 2021):

@sigma67 I am using youtube music from unsupported regions with vpn. any chance this could be the reason ?

<!-- gh-comment-id:983492448 --> @BruceZhang1993 commented on GitHub (Dec 1, 2021): @sigma67 I am using youtube music from unsupported regions with vpn. any chance this could be the reason ?
Author
Owner

@sigma67 commented on GitHub (Dec 12, 2021):

That is most likely the reason. Not sure if it's worth implementing a workaround for this niche case

<!-- gh-comment-id:991961697 --> @sigma67 commented on GitHub (Dec 12, 2021): That is most likely the reason. Not sure if it's worth implementing a workaround for this niche case
Author
Owner

@BruceZhang1993 commented on GitHub (Dec 13, 2021):

That is most likely the reason. Not sure if it's worth implementing a workaround for this niche case

Thanks a lot anyway, i'll try to find a workaround in my project.

<!-- gh-comment-id:992029971 --> @BruceZhang1993 commented on GitHub (Dec 13, 2021): > That is most likely the reason. Not sure if it's worth implementing a workaround for this niche case Thanks a lot anyway, i'll try to find a workaround in my project.
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#185
No description provided.