Quantcast
Channel: How to find out the exact RSS XML path of a website? - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Answer by the Tin Man for How to find out the exact RSS XML path of a website?

$
0
0

Something like this in Ruby will work...

require 'rubygems'require 'nokogiri'require 'open-uri'html = Nokogiri::HTML(open('http://stackoverflow.com/questions/2441954/how-to-find-out-the-exact-rss-xml-path-of-a-website'))puts html.css('link[type="application/atom+xml"]').first.attr('href')#  =>"/feeds/question/2441954"

Notice it's an absolute URL path, which is legal so you'd need to prepend the host info.

Also, "application/atom+xml" could also be "application/rss+xml" or "application/rdf+xml", and multiple links can be found in a page so you'll need to decide how to handle multiples. According to the autodiscovery docs the first one presented should be the preferred one, but from experience I've seen otherwise. Also, according to the docs the links should not be alternate data types (RSS and ATOM pointing to the same content) but should be different content, but again, I've seen that happen.


Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>