I asked this question before, but there was no answer. so ask again.
I just cannot determine which class of the gdata framework to use so that I can search for videos on YouTube. I used some classes while debugging the code, but I think the structure is so deep that it can take a long time to understand this problem. so please help me. I have a search box in my application, and I want that after entering any keyword in this search field and clicking the search button, I should get the correct answer. I tried the code but always returns the same result.
here is my code ...
-(void)searchYoutube
{
NSString *searchString = [NSString stringWithFormat:@"%@", searchField.text];
NSURL *feedURL = [GDataServiceGoogleYouTube youTubeURLForFeedID:nil];
GDataQueryYouTube* query = [GDataQueryYouTube youTubeQueryWithFeedURL:feedURL];
[query setStartIndex:1];
[query setMaxResults:50];
[query setVideoQuery:searchString];
GDataServiceGoogleYouTube *service = [self youTubeService];
GDataServiceTicket *ticket;
ticket = [service fetchFeedWithURL:feedURL delegate:self
didFinishSelector:@selector(ticket:finishedWithFeed:error:)];
}
below is the code for cellForRowAtIndexPath: method
- (UITableViewCell *)tableView:(UITableView *)tableView1 cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *CellIdentifier = @"Cell";
CustomCellVideoList *cell = (CustomCellVideoList *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[CustomCellVideoList alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
GDataEntryBase *entry = [[feed entries] objectAtIndex:indexPath.row];
NSArray *thumbnails = [[(GDataEntryYouTubeVideo *)entry mediaGroup] mediaThumbnails];
GDataYouTubeMediaGroup *mediaGroup = [(GDataEntryYouTubeVideo *)entry mediaGroup];
GDataMediaDescription *desc = [mediaGroup mediaDescription];
GDataMediaTitle *mTtile = [mediaGroup mediaTitle];
NSLog(@"media group----- \n\n%@",[(GDataEntryYouTubeVideo *)entry mediaGroup]);
cell.videoTitle.text = [mTtile stringValue ] ;
cell.videoDesc.text = [desc stringValue];
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:[[thumbnails objectAtIndex:1] URLString]]];
cell.data = data;
}
any help is appreciated
thank
source
share