IamGretar
IamGretar

Reputation: 175

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.

Upvotes: 5

Views: 9869

Answers (2)

remjx
remjx

Reputation: 4592

In the YouTube Data API V3 it is a little different. Each search query returns a "nextPageToken" that can be used in a subsequent query for more results. Documentation: https://developers.google.com/youtube/v3/guides/implementation/pagination

Upvotes: 0

jlmcdonald
jlmcdonald

Reputation: 13667

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.

Upvotes: 5

Related Questions