get elements using youtube API on objective C
I have gone through the documentation, used the sample project and even have the retrieval of a youtube feed working on my app but I am unable to get the individual elements to then displays as I desire.
I am able to get for example the first video using objectAtIndex:0 but then don't know how to get title, id, url, etc. here is an NSLog of my firs video in the feed.
entry: GDataEntryYouTubeVideo 0x9eb8d50: {v:2.0 title:Evolution of Dance - By Judson Laipply contentSrc:http://www.youtube.com/v/dMH0bHeiRNg?f=standard&d=AVEzC5trXMDfhc6PnAqxlmIO88HsQjpE1a8d1GxQnGDm&app=youtube_gdata etag:W/"A0cHQ347eCp7ImA9Wx9UGUo." authors:1 categories:4 links:alternate,video.responses,video.ratings,video.complaints,video.related,self id:tag:youtube.com,2008:video:dMH0bHeiRNg rating:+706815/-62385 comment:GDataComment 0x9ebeb50: {feedLink:GDataFeedLink 0x9ebf2c0: {href:http://gdata.youtube.com/feeds/api/videos/dMH0bHeiRNg/comments countHint:500786 href:http://gdata.youtube.com/feeds/api/videos/dMH0bHeiRNg/comments countHint:500786}} stats:GDataYouTubeStatistics 0x9ebfeb0: {viewCount:164922648 favoriteCount:1010039} mediaGroup:GDataYouTubeMediaGroup 0x9ec0e10: {categories:(
"GDataMediaCategory 0x9ec41f0: {label:Comedy scheme:http://gdata.youtube.com/schemas/2007/categories.cat content:Comedy}"
) contents:(
"GDataMediaContent 0x9ec2df0: {url:http://www.youtube.com/v/dMH0bHeiRNg?f=standard&d=AVEzC5trXMDfhc6PnAqxlmIO88HsQjpE1a8d1GxQnGDm&app=youtube_gdata type:application/x-shockwave-flash medium:video isDefault:true expressi开发者_开发知识库on:full duration:360}",
"GDataMediaContent 0x9ec3620: {url:rtsp://v5.cache7.c.youtube.com/CkcLENy73wIaPgnYRKJ3bPTBdBMYDSANFEgGUghzdGFuZGFyZHIhAVEzC5trXMDfhc6PnAqxlmIO88HsQjpE1a8d1GxQnGDmDA==/0/0/0/video.3gp type:video/3gpp medium:video expression:full duration:360}",
"GDataMediaContent 0x9ec39b0: {url:rtsp://v3.cache8.c.youtube.com/CkcLENy73wIaPgnYRKJ3bPTBdBMYESARFEgGUghzdGFuZGFyZHIhAVEzC5trXMDfhc6PnAqxlmIO88HsQjpE1a8d1GxQnGDmDA==/0/0/0/video.3gp type:video/3gpp medium:video expression:full duration:360}"
) credits:(
"GDataMediaCredit 0x9ec4730: {role:uploader scheme:urn:youtube content:judsonlaipply}"
) thumbnails:(
"GDataMediaThumbnail 0x9ec4fb0: {url:http://i.ytimg.com/vi/dMH0bHeiRNg/default.jpg height:90 width:120 time:00:03:00 unparsedAttr:yt:name}",
"GDataMediaThumbnail 0x9ec5820: {url:http://i.ytimg.com/vi/dMH0bHeiRNg/hqdefault.jpg height:360 width:480 unparsedAttr:yt:name}",
"GDataMediaThumbnail 0x9ec5bc0: {url:http://i.ytimg.com/vi/dMH0bHeiRNg/1.jpg height:90 width:120 time:00:01:30 unparsedAttr:yt:name}",
"GDataMediaThumbnail 0x9ec5ea0: {url:http://i.ytimg.com/vi/dMH0bHeiRNg/2.jpg height:90 width:120 time:00:03:00 unparsedAttr:yt:name}",
"GDataMediaThumbnail 0x9ec6140: {url:http://i.ytimg.com/vi/dMH0bHeiRNg/3.jpg height:90 width:120 time:00:04:30 unparsedAttr:yt:name}"
) keywords:GDataMediaKeywords 0x9ec66f0: {content:Dancing, comedy keywords:Dancing, comedy} description:GDataMediaDescription 0x9ec4e10: {type:plain content:For more visit http://www.mightaswelldance.com} players:(
"GDataMediaPlayer 0x9ec2e40: {url:http://www.youtube.com/watch?v=dMH0bHeiRNg&feature=youtube_gdata_player}"
) title:GDataMediaTitle 0x9ec6aa0: {type:plain content:Evolution of Dance - By Judson Laipply} duration:360 videoID:dMH0bHeiRNg uploaded:GDataDateTime 0x7359b80: {2006-04-06T21:30:53Z}} accessControls:(
"GDataYouTubeAccessControl 0x9ec0500: {action:comment permission:allowed content:}",
"GDataYouTubeAccessControl 0x9ec0930: {action:commentVote permission:allowed content:}",
"GDataYouTubeAccessControl 0x9ec09f0: {action:videoRespond permission:moderated content:}",
"GDataYouTubeAccessControl 0x9ebeba0: {action:rate permission:allowed content:}",
"GDataYouTubeAccessControl 0x9ebf9f0: {action:embed permission:allowed content:}",
"GDataYouTubeAccessControl 0x9ec0620: {action:list permission:allowed content:}",
"GDataYouTubeAccessControl 0x9ec0b50: {action:syndicate permission:allowed content:}"
) unparsed:<gd:rating>}
resolved, compare the calls with the xml above so that you may use on other gdata feeds
GDataEntryBase *entry = [[feed entries] objectAtIndex:indexPath.row];
NSString *title = [[entry title] stringValue];
NSArray *thumbnails = [[(GDataEntryYouTubeVideo *)entry mediaGroup] mediaThumbnails];
cell.textLabel.text = title;
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:[[thumbnails objectAtIndex:0] URLString]]];
cell.imageView.image = [UIImage imageWithData:data];
精彩评论