我在用

[google-api-objectivec-client](https://code.google.com/p/google-api-objectivec-client/

我想获得任何YouTube视频的评论。如果有人尝试过,请指导我该怎么做。

这是我获得最流行视频的代码

- (void)getMostPopularOnCompletion:(void (^)(void))completion withCurrentUserChannel:(GTLYouTubeChannel*)currentUserChannel{

    mostPopularFlag = YES;
    hud = [MBProgressHUD showHUDAddedTo:self.revealController.navigationController.view animated:YES];
    hud.mode = MBProgressHUDModeIndeterminate;
    hud.labelText = @"Loading";

    GTLQueryYouTube *videoQuery = [GTLQueryYouTube queryForPlaylistItemsListWithPart:@"id, snippet, contentDetails, statistics" Chart:@"mostPopular"];
    videoQuery.maxResults = 50;

    //    if(nextPageToken){
    //        videoQuery.pageToken = nextPageToken;
    //    }

    [_menu.youtubeService executeQuery:videoQuery
                     completionHandler:^(GTLServiceTicket *ticket, GTLYouTubeVideoListResponse *object, NSError *error) {
                         _mostPopularVideos = [object.items mutableCopy];
                         _mostPopularVideosOriginal = [object.items mutableCopy];
                         [_filterSegmentO setSelectedSegmentIndex:0];
                         [_mainTableView setAccessibilityHint:@"0"];
                         [hud hide:YES];
                         hud=nil;
                         [_mainTableView setTag:0];
                         [_mainTableView reloadData];
                         for (int i = 0; i < object.items.count; i++) {
                             GTLYouTubeVideo *video = object.items[i];
                             [self getChannelImage:video.snippet.channelId];
                         }

                        if (completion){
                             completion();
                         }
                     }];
}

最佳答案

注释读/写在Data API v3上尚不可用(它是objc-client的基础)。但是您可以read through the old API

关于ios - 如何使用“google-api-objectivec-client”获取/提交任何youtube视频的评论,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21756225/

10-11 22:14
查看更多