diegoaguilar
diegoaguilar

Reputation: 8376

How to paginate if no page token present in Youtube API search request

I'm querying videos to Youtube API with AngularJS this way:

$http.get('https://www.googleapis.com/youtube/v3/search', {
  params: {
    key: 'API_KEY',
    type: 'video',
    part: 'id,snippet',
    maxResults: '10',
    fields: 'items/id,items/snippet/title,items/snippet/description,items/snippet/thumbnails/default,items/snippet/channelTitle',
    q: query
  }
}

However, the response object is only returning a JSON response with items property but there's not a nextPageToken or pageInfo properties.

I need to obtain multiple results, so it's pretty important to me to be capable to paginate the search.

I already tried with out maxResults query param but got not results. How can I achieve it?

Upvotes: 0

Views: 137

Answers (1)

diegoaguilar
diegoaguilar

Reputation: 8376

I was trimming the API answer to myself:

fields: 'items/id,items/snippet/title,items/snippet/description,items/snippet/thumbnails/default,items/snippet/channelTitle'

So the fields param is the one telling API which response properties to include.

Upvotes: 1

Related Questions