mirror of
https://github.com/sigma67/ytmusicapi.git
synced 2026-04-25 15:26:01 +03:00
[GH-ISSUE #19] Hitting an API rate limit raises KeyError from create_playlist() #14
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#14
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 @beville on GitHub (May 16, 2020).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/19
In my experimentation auto-generating playlists, I started getting a KeyError from create_playlist().
I stuck a debug in there, and saw this in the JSON response:
The python API should probably catch this and return an error code or throw a custom exception.
@sigma67 commented on GitHub (May 17, 2020):
Interesting, this is the first time I've come across rate limits in their API. I agree that this should be caught with a custom exception.
Do you have an estimate on what the limit is? We might want to include that in the error message.
@beville commented on GitHub (May 17, 2020):
I don't have a solid idea of the limit.
I was testing a function that takes a playlist title, searches the results of get_library_playlists() for that then, and then creates the playlist it if title is missing. Even though the call to create it was succeeding, it wasn't showing up in the list on the next run. I probably created it 20 times in the course of 15 minutes? Then I started seeing the playlist appear many times in the web UI. Looks like there is some latency is the back end before the new playlist propagates through. Also, I'm not sure there were as many dupe playlists that showed up as the ones that were created.
This morning I didn't get the limit error, so maybe the block is about 12-24 hours?
I ran the create once, and after 15-20 minutes, I still don't see the playlist in the web UI...
@sigma67 commented on GitHub (May 18, 2020):
I've noticed the latency after creating a playlist as well. This has only started happening recently, indicating that probably something on YouTube's end has changed
It's strange because it doesn't happen when it's created using the web UI. Need to do some thorough testing to figure out the cause
@beville commented on GitHub (May 18, 2020):
As I was playing around yesterday, I noticed that when I called create_playlist() and passed a track list, the new playlist never showed up, even though I got a new ID. But when I called create_playlist() and didn't pass a playlist, and right after called add_playlist_items(), I would see the new playlist within a few minutes.
@sigma67 commented on GitHub (May 18, 2020):
You're correct, this seems to be a restriction on YouTube's end. I verified this on the Web UI:
@beville commented on GitHub (May 18, 2020):
Ha, I just went to YTM site now, and all the 'lost' empty playlists from this weekend have shown up! So weird.
Once I saw there were issues, I started putting a timestamp string into the description. Some that I created Saturday afternoon appeared after Sunday night!