I'm building some functionality that will enable users to import their existing blog posts to their account on my site. I have already implemented this and it works great as long as the user submits an RSS feed URL to my site. The problem I'm having is that many users just paste in their blog URL rather than their RSS feed url. I could resort to forcing users to go and get their RSS url by validating the address they submit but, well, I'm just too nice and I'd love to be able to get that feed URL for them.
Is there anything that will find an RSS feed on a web page? I noticed that Firefox does it with a little icon on in the address bar.
Find RSS / Atom feed on a web page
Moderator: General Moderators
- R4000
- Forum Contributor
- Posts: 168
- Joined: Wed Mar 08, 2006 12:50 pm
- Location: Cambridge, United Kingdom
Re: Find RSS / Atom feed on a web page
Firefox does this by looking for the following in the page's <head>:
It depends how detailed you want to do this.
You could detect all <a> links for one with .xml in it and then visit that link and see if its a vaild rss feed.
Or you could visit every link on the page to detect for a rss feed.
Or you could just try to detect the code above for a rss feed (using regexp?)
Code: Select all
<link href="http://www.example.com/some.rss" rel="alternate" type="application/rss+xml" title="TITLE OF YOUR RSS FEED" />You could detect all <a> links for one with .xml in it and then visit that link and see if its a vaild rss feed.
Or you could visit every link on the page to detect for a rss feed.
Or you could just try to detect the code above for a rss feed (using regexp?)