Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

yt:quota too many recent calls - Youtube API help

Tags:

youtube

api

I am using youtube api to get contents from a youtube account (with just user feed...without user authentication) on our website. Since yesterday morning, we keep getting:

<error>
    <domain>yt:quota</domain>
    <code>too_many_recent_calls</code>
</error>

It started off as a random occurrence, but very soon, we get this error 100% of the time. I tried the following quota limits instructions but I still get the error:

If you are receiving quota errors, there are a couple steps you can take:

  • Have your requests include your developer key and clientID. I do this
  • Make sure the actions your code is performing is user-initiated. I do this
  • Pass the user's IP address in the restriction query parameter. I am able to pass only the proxy/server IP address, not the exact client's because Google AppEngine does not support InetAddress.getLocalHost().getHostAddress())
  • If you are requesting authenticated feeds, login as the user rather than a site-wide account. I am not using authentication
like image 372
Satish Avatar asked Feb 28 '23 19:02

Satish


1 Answers

I had the same problem with Youtube API + App-Engine. I was passing the developer-key as parameter of the request, as well as the other suggested parameters (user-ip, developer-key in the request url) and still didn't work with App Engine.

Well it seemed that the developer key wasn't getting through (although X-Gdata-key was present in the POST request headers). I've found this solution:

Every YouTubeService instance has the attributes developer_key and client_id. Setting this attributes when creating the service instance (instead of setting the 'X-GData-Key' in the headers or the key attribute of a query instance) makes the developer_key for the app id: client_id to be sent in every request, and accepted successfully.

You can set these values in the constructor of YouTubeService for the Java API.

If you are using the API for Python, you can set the parameters directly as following:

client = gdata.youtube.service.YouTubeService()
    client.client_id = <application_id>
    client.developer_key = <developer_key>

I noticed that my developer_key wasn't getting through by checking the stats on the YouTube API dashboard.

like image 89
Javierfdr Avatar answered Mar 06 '23 14:03

Javierfdr