mirror of
https://github.com/sigma67/ytmusicapi.git
synced 2026-04-25 07:16:00 +03:00
[GH-ISSUE #805] get_library_playlists results in a KeyError #504
Labels
No labels
a/b
bug
documentation
enhancement
good first issue
help wanted
invalid
pull-request
question
wontfix
yt-error
yt-update
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ytmusicapi#504
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @apastel on GitHub (Aug 22, 2025).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/805
Describe the bug
A user of my application that uses ytmusicapi is experiencing a
KeyErrorwhen the app callsget_library_playlists(limit=1).ytmusicapi version
1.10.3
To Reproduce
Steps to reproduce the behavior:
yt.get_library_playlists(limit=1)(although I imagine thelimitis irrelevant here).Additional context
If this is an A/B testing issue, I know the best way to solve this is usually to get a copy of the user's JSON response from the browser's dev tools, but I'm not sure which request it is that we want to look at. Is it
browse?@sigma67 commented on GitHub (Aug 22, 2025):
Have you tried 1.11.0?
At least in our tests we aren't having this problem, so it could also be specific to your library or account as you suggested.
@apastel commented on GitHub (Aug 22, 2025):
I misrepresented which ytmusicapi version they are using. 1.10.3 was cached on my system but I got the output of their system:
Yes since this hasn't happened with other users of my app I believe it's probably specific to their account and not a bug with the API but maybe an A/B test. I just wasn't sure how else to report it (maybe in Discussions?)
Is there a particular JSON response that I should ask them for that we can look at to confirm?
@sigma67 commented on GitHub (Aug 23, 2025):
Yeah that would be helpful. Just the JSON response when going to the Library Playlists page. Maybe also a screenshot of the layout of the page, in case something is changing there
@apastel commented on GitHub (Aug 24, 2025):
Well after looking at a screenshot of their playlists, I'm pretty sure I know what the problem is.
He's got this playlist at the beginning with no name and no tracks. It's a total zombie, he can't do anything to get rid of it, it seems. There's a "Remove playlist from library" context menu option, but the playlist just comes back when refreshing. Same on mobile. So it seems like it's permanently stuck there. Based on the stack trace, it seems like it's choking on "title" which makes sense because there isn't one.
Here is the response JSON for the library playlists page, but I didn't find anything unusual about the format or anything, which is again why I think it's an issue with this one broken playlist: playlists.json
So since this broken playlist seems to be permanently stuck, and since I've never encountered this before, in the meantime I may just monkeypatch the
parse_playlistfunction in my application to usenone_if_absentfor "title". But if you wanted to make that a change in ytmusicapi itself, that's up to you. I could understand not wanting to make that change for this rare occurence, but I guess it could happen to other users too.@apastel commented on GitHub (Aug 24, 2025):
The user downloaded my app with the monkeypatched parser and it worked for them.
My patch added this to the beginning of
parse_playlist@sigma67 commented on GitHub (Aug 24, 2025):
PR welcome