Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
718 views
in Technique[技术] by (71.8m points)

limit - YouTube Data API v3 returns 429 Resource has been exhausted, haven't used nearly full quota

I'm using the YouTube Data API v3 to insert playlists and playlist items.

As noted in the title, I'm getting a 429 / resource exhausted response but don't believe we're really using the quota up -- or, I'm misunderstanding our quota.

Today I created 8 Playlists and 187 videos which I believe is 9,400 "units" of quota over about 90 minutes and got this message...

Error: {code: 429, message: "Resource has been exhausted (e.g. check quota).", errors: Array(1), status: "RESOURCE_EXHAUSTED"}

Here's what's listed on the Quota page in cloud console for this key which seems to have enough overhead for this...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

According to the official document Google APIs - Global domain errors, the error you have obtained from the API has the following specification:

TOO_MANY_REQUESTS (429)
rateLimitExceeded Too many requests have been sent within a given time span.

Thus the API is signaling you that you've issued too many API requests in a small amount of time.

An accustomed solution to this is to have your program catch these kind of errors for to implement exponential backoff retrying the culprit API call.


Addendum

According to Google staff, you have to wait for a while before you're allowed to create new playlists:

Status: Won't Fix (Intended Behavior)
Creating high volumes of playlists via the API in a short amount of time may result in this error. The length of time to wait is variable. You may wish to use a method such as exponential backoff or queuing for a retry later in cases where you're attempting to fulfill a request on behalf of a user.

Do note that you hit an undocumented limit of YouTube Data API. Unfortunately, this API has quite a few of them. Stackoverflow and Google's own issue tracker did uncovered some of those limits.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...