我能得到的只是片段变量......没有相关的统计数据。我正在尝试获取每个特定视频的喜欢、不喜欢和持续时间。
+(void) getListOfVideosFromSearchTerm: (NSString *) term usingCallback: (getListOfVideosCallback) callback{
if (youTubeService.authorizer == nil) callback(nil);
__block NSMutableArray *videosArray = [NSMutableArray array];
GTLQueryYouTube *query = [GTLQueryYouTube queryForSearchListWithPart:@"id,snippet"];
query.maxResults = 10;
query.q = term;
query.videoEmbeddable = @"true";
query.type = @"video";
GTLServiceTicket *ticket = [youTubeService executeQuery:query
completionHandler:^(GTLServiceTicket *ticket, id object, NSError *error) {
// This callback block is run when the fetch completes
if (error == nil) {
GTLYouTubeSearchListResponse *products = object;
// iteration of items and subscript access to items.
for (GTLYouTubeSearchResult *item in products) {
ILVVideo *newVideo = [[ILVVideo alloc] init];
newVideo.title = item.snippet.title;
newVideo.description = item.snippet.descriptionProperty;
newVideo.thumbnail.urlForHighResolution = item.snippet.thumbnails.high.url;
newVideo.thumbnail.highResolutionSize = CGSizeMake([item.snippet.thumbnails.high.width floatValue], [item.snippet.thumbnails.high.height floatValue]);
newVideo.thumbnail.urlForMediumResolution = item.snippet.thumbnails.medium.url;
newVideo.thumbnail.mediumResolutionSize = CGSizeMake([item.snippet.thumbnails.medium.width floatValue], [item.snippet.thumbnails.medium.height floatValue]);
newVideo.thumbnail.urlForStandardResolutionImage = item.snippet.thumbnails.standard.url;
newVideo.thumbnail.standardResolutionSize = CGSizeMake([item.snippet.thumbnails.standard.width floatValue], [item.snippet.thumbnails.standard.height floatValue]);
[videosArray addObject:newVideo];
NSLog(@"%@",item.snippet.title);
}
callback(videosArray);
}else{
NSLog(@"Error: %@", error.description);
}
}];
}