我正在使用GTLQueryYoutube获取已上传视频的列表。我实际上登录了我的Google帐户。使用以下代码获取上传的视频
//Get my channel
GTLQueryYouTube *channelsListQuery = [GTLQueryYouTube queryForChannelsListWithPart:@"contentDetails"];
channelsListQuery.mine = YES;
youtubeService.APIKey = kGoogleClientAPIKey;
// This callback uses the block syntax
[youtubeService executeQuery:channelsListQuery completionHandler:^(GTLServiceTicket *ticket, GTLYouTubeChannelListResponse*response, NSError *error) {
if (error) {
//Process error later
return;
}
if ([[response items] count] > 0) {
//Get Uploaded ids
GTLYouTubeChannel *channel = response[0];
NSString *uploadsPlaylistId = channel.contentDetails.relatedPlaylists.uploads;
GTLQueryYouTube *playlistItemsListQuery = [GTLQueryYouTube queryForPlaylistItemsListWithPart:@"contentDetails"];
playlistItemsListQuery.maxResults = 20l;
playlistItemsListQuery.playlistId = uploadsPlaylistId;
playlistItemsListQuery.mine = YES;
[youtubeService executeQuery:playlistItemsListQuery completionHandler:^(GTLServiceTicket *ticket, GTLYouTubePlaylistItemListResponse *response, NSError *error) {
if (error) {
return;
}
NSMutableArray *videoIds = [NSMutableArray arrayWithCapacity:response.items.count];
for (GTLYouTubePlaylistItem *playlistItem in response.items) {
[videoIds addObject:playlistItem.contentDetails.videoId];
}
GTLQueryYouTube *videosListQuery = [GTLQueryYouTube queryForVideosListWithPart:@"id, contentDetails, snippet, **fileDetails**"];
videosListQuery.identifier = [videoIds componentsJoinedByString: @","];
videosListQuery.mine = YES;
[youtubeService executeQuery:videosListQuery
completionHandler:^(GTLServiceTicket *ticket, GTLYouTubeVideoListResponse *response, NSError *error) {
if (error) {
return;
}
NSArray* videoArray = response.items;
//Do somethings with videoArray
}];
}];
}
}];
考虑“videosListQuery”查询,它有一个名为“fileDetails”的部分,因此在此查询上返回的每个视频都应该实现fileDetails属性。但结果是对比,每个视频的fileDetails属性总是为零
fileDetails属性只能由所有者检索,但我已登录,这是我上传的视频。为什么我不能找回它?