I would like to know the best way to get passed the video maxResults. I can't set it past 50. I need to get about 207 videos right now. This list will continue to grow over time.
Do you have any suggestions on how I would do this?
GTLServiceYouTube *service = [[GTLServiceYouTube alloc] init];
service.APIKey = @"API Key";
service.shouldFetchInBackground = YES;
GTLQueryYouTube *query = [GTLQueryYouTube queryForPlaylistItemsListWithPart:@"snippet,contentDetails"];
query.playlistId = @"Playlist ID";
query.maxResults = 50;
GTLServiceTicket *ticket = [service executeQuery:query
completionHandler:^(GTLServiceTicket *ticket, id object, NSError *error) {
// This callback block is run when the fetch completes
if (error == nil)
{
GTLYouTubeSearchListResponse *products = object;
GTLYouTubePlaylistItemListResponse *playlistItems = object;
for (GTLYouTubeSearchResult *item in products)
{
GTLYouTubeThumbnailDetails *thumbnails = item.snippet.thumbnails;
GTLYouTubeThumbnail *thumbnail = thumbnails.high;
NSString *thumbnailString = thumbnail.url;
if (thumbnailString != nil)
{
[self.thumbnailsURL addObject:thumbnailString];
[self.thumbnailsArray addObject:thumbnailString];
[self.thumbnailImages addObject:@"120x120@2x.png"];
[self.thumbnailTitleArray addObject:item.snippet.title];
}
}
for (GTLYouTubePlaylistItem *playlistItem in playlistItems)
{
GTLYouTubePlaylistItemContentDetails *details = playlistItem.contentDetails;
[self.videos addObject:details.videoId];
}
}
else
{
NSLog(@"Error: %@", error.description);
}
self.loading.hidden = YES;
[self.tableView reloadData];
}];
Thank you in advance for your time! :D