How do browsers know there is an RSS feed present for a given URL
I get a URL from a user. I need to know: a) is the URL a valid RSS feed? b) if not is there a valid feed associated with that URL? Using Objective-c
Can any one help me to solve this.
Thanks in开发者_运维问答 advance.
Web pages that have an associated feed will have an alternate link with one of the feed MIME types:
<link rel="alternate" type="application/rss+xml" title="RSS Feed" href="somefeed.rss" />
<link rel="alternate" type="application/atom+xml" title="Atom Feed" href="somefeed.atom" />
You can use an XML parser to inspect the returned page for a URL and see if it adheres to the RSS or Atom specs.
If you're validating publicly available feeds, the feedvalidator can be useful. It uses simple GET requests:
http://www.feedvalidator.org/check.cgi?url=http%3A%2F%2Fstackoverflow.com%2Ffeeds
精彩评论