Krzemienski
Krzemienski

Reputation: 1185

Using Gdata to get stats about a video

I am populating a table with a result from queries of YouTube videos by using the Google API. I see there is a header file in the api called GDataYouTubeStatistics.h but I don't necessarily know how to go about accessing the data.

DataEntryBase *entry = [[feed entries] objectAtIndex:indexPath.row];
NSString *title = [[entry title] stringValue];
NSArray *thumbnails = [[(GDataEntryYouTubeVideo *)entry mediaGroup] mediaThumbnails];

That is how I go about getting the thumbnails and the titles but I need view counts and other stat properties.

Thanks any help would be great!

Upvotes: 3

Views: 390

Answers (1)

Krzemienski
Krzemienski

Reputation: 1185

Well after some work...this is how you solve it.

 //This video is from the feed.
 GDataEntryYouTubeVideo * video;

GDataYouTubeRating * rating = [video rating];

GDataYouTubeStatistics * stats = [video statistics];

NSNumber * likes = [rating numberOfLikes];    
NSNumber * dislikes = [rating numberOfDislikes];

 NSNumber * views2 = [stats viewCount];

Upvotes: 2

Related Questions