I am using AFNetworking to parse JSON data on UITableView. YouTube api give JSON data for max 50 videos. I need to load more than 100 videos and i am not sure how to do that.
Here is the url i am using to get the files from the API:
http://gdata.youtube.com/feeds/api/playlists/PL7CF5B0AC3B1EB1D5?v=2&alt=jsonc&max-results=50
And here is my code:
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *urlAsString = @"http://gdata.youtube.com/feeds/api/playlists/PL7CF5B0AC3B1EB1D5?v=2&alt=jsonc&max-results=50";
NSURL *url = [NSURL URLWithString:urlAsString];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
// This will initiate the request and parse the data using apples JSONSerialization
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
self.videoMetaData = [JSON valueForKeyPath:@"data.items.video"];
// This will have all the sq and hq thumbnails
self.allThumbnails = [JSON valueForKeyPath:@"data.items.video.thumbnail"];
Provide the
start-index-option. For example:http://gdata.youtube.com/feeds/api/playlists/PL7CF5B0AC3B1EB1D5?v=2&alt=jsonc&max-results=50&start-index=51:http://gdata.youtube.com/feeds/api/playlists/PL7CF5B0AC3B1EB1D5?v=2&alt=jsonc&max-results=50&start-index=51See the YouTube API v. 2.0 reference.