Get the full list of feed url patterns?
I have seen some similar questions on stackoverflow and on searched on google too but开发者_如何学Go could not get a satisfying answer.
I am doing an application in which data is shown into a table. Now on selecting a row I need to now that if this will lead to a page where I am expected to see feeds. I am trying to detect the url via this method, but not sure that this will give me the best results and may be I would be missing some more cases, so I need the help in two ways:
- Is there a better way to do this?
Or are these cases complete (means, do I need to test more cases)?
-(BOOL)checkForTheFeed:(NSString *)address{ if([address hasSuffix:@"/feed/"]) return YES; if([address hasPrefix:@"feed://"]) return YES; if([address rangeOfString:@"=rss"].location != NSNotFound) return YES; if([address rangeOfString:@".rss"].location != NSNotFound) return YES; if([address hasSuffix:@"/rss/"]) return YES; if([address rangeOfString:@"/feeds."].location != NSNotFound) return YES; if([address rangeOfString:@".feeds."].location != NSNotFound) return YES; if([address hasSuffix:@".xml"]) return YES; return NO; }
If I miss some cases please try to add them.
Thanks,
Madhup
You should really look at the content-type and content of the remote resource. Looking at a URL to figure out what kind of data it points to is the wrong approach.
精彩评论