Quote:
Originally Posted by ganesh.sics
I have an RSS link in which there are rss links to pages such as AFL,Football, Basketball,Cricket etc. When I click that the RSS links are obtained. For example in case of AFL the rss link directs to the page
Sportal.com.au - AFL News Headlines
Here there are tags called "description" but there is only a part of description inside that tag. The full description is present inside the link present inside the tag "link". Here for example the link is
Pies duo set to feature - AFL - Sportal Australia
How can I get these full description from the above link? I'm in such a urgency. Any help is appreciated.
//The Main Link is //http://www.sportal.com.au/rss
Thanks
|
You can get NSData from the url via [NSData dataWithContentsOfURL:url];
You would then have to know how to extract the information from the nsdata that you are interested in. If it is always the same website with the same format, look at the source of the website. If there is a an object such as a div with a specific class name, you could pull all the html in that div.
Here is a synchronous example (depending on the html size, you may want to do this with a asynchronous data request):
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://beachforbaby.com/30-before-30-cali-style/"]];
NSString* newStr = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
NSString *substring;
NSScanner *htmlScanner = [NSScanner scannerWithString:newStr];
[htmlScanner scanUpToString:@"<div class=\"blog_info\">" intoString:NULL];
[htmlScanner scanUpToString:@"<p>" intoString:NULL];
[htmlScanner scanUpToString:@"</div><!--/blog_info-->" intoString:&substring];
NSLog(@"Substring: %@", substring);
And then clean up the html tags, unwanted data, etc.
James