Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Max-results value is too high.YouTube API

I'm trying to load the first 100 videos of a YouTube channel and I can only load 50 videos. I always get this error message

Max-results value is too high. Only up to 50 results can be returned per query.

and I'm using this URL.

http://gdata.youtube.com/feeds/api/users/shaytards/uploads?&max-results=100

I'm not sure if I need any kind of developer key to load 100 results. Even if you know a way to load videos 75-100 would be great but any help would be appreciated.

like image 354
IamGretar Avatar asked Jun 20 '13 13:06

IamGretar


People also ask

Does YouTube API have a limit?

Quota usage You can find the quota available to your application in the API Console. Projects that enable the YouTube Data API have a default quota allocation of 10,000 units per day, an amount sufficient for the overwhelming majority of our API users.

Why is YouTube API not working?

My YouTube API Key is Not Working Your API key may not be working because you're using it for the wrong project. Be sure you're using the key for the project that you created it for, especially if you created multiple projects at the same time. If it's still not working, consider creating a new API key entirely.

What is the pageToken in YouTube API?

The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken and prevPageToken properties identify other pages that could be retrieved.

Does YouTube API cost money?

The YouTube Data API, is a free API google does not charge you for accessing this api. You are free to use it. THere for no billing account is needed in order to access this api. You do have a quota which limits the number of request that you can make to the api over a period of time.


1 Answers

The Youtube data API requires you to set up your own pagination if you need to get more than 50 results. In this case, then, you would set max-results to 50 and do the query, then on your page have some sort of "next" button (or however you want to implement your pagination) that would trigger a new call (either through ajax, a new page, or whatever your own workflow is). This new call would be to the same data feed, but you'd append the parameter &start-index=51 so that you'd get 50 more results, numbered 51-100. You can continue on like this up to 1000 results.

See https://developers.google.com/youtube/2.0/reference#Paging_through_Results for more details.

like image 123
jlmcdonald Avatar answered Sep 28 '22 10:09

jlmcdonald