OUseful.Info, the blog…

Trying to find useful things to do with emerging technologies in open education

Feed Autodiscovery With YQL

Just a quick follow up to the post on using Beautiful Soup for RSS feed autodetection – it struck me that I should be able to do a similar thing with YQL:

YQL feedautodetect

Remember, feed autodiscovery relies on web page containing the following construction in the HTML <head> element:
<link rel=”alternate” type=”application/rss+xml” href=”FEED_URL” title=”FEED_NAME” />

So to try and autodetect the feed in a web page, we can use the following YQL statement:

select * from html where url="http://news.google.co.uk" and
xpath='//link[@rel="alternate" and @type="application/rss+xml"]'

Feed autodetection in YQL

We can then generalise this and create a query alias that allows us to pass in a URL and get any autodetected feeds back:

That is, use the query:

select * from html where url=@url and
xpath='//link[@rel="alternate" and @type="application/rss+xml"]'

We can look for atom feeds too:
select * from html where url=@url and xpath='//link[@rel="alternate" and (@type="application/rss+xml" or @type="application/atom+xml")]'

In this case, I’ve used the argument url for the original page URL, and specified the query alias feedautodetect, which means I can run a query remotely as follows:

http://query.yahooapis.com/v1/public/yql/psychemedia/feedautodetect
?url=PAGE_URL&format=json

The format=json switch forces the query to provide the response using JSON (

Written by Tony Hirst

October 22, 2010 at 2:52 pm

Posted in Tinkering

Tagged with ,

4 Responses

Subscribe to comments with RSS.

  1. [...] Trying to find useful things to do with emerging technologies in open education BlogAboutSearch « Feed Autodetection With YQL [...]

  2. [...] code works something like this: – grab a URL and use the YQL feed autodiscovery custom query to find any RSS or Atom feeds that are auto-discoverable for the blog; – if necessary, add path [...]

  3. [...] For what it’s worth, I’ve posted a demo showing a couple of feed autodiscovery/autodetection tricks that let you autodiscover feeds in remote pages via a couple of online services: the Google feed api, and YQL (Feed Autodiscovery With YQL). [...]

  4. [...] more to get the RSS feeds for these sites.Step 2 Auto-discovering feed urlsInitially i tried using Feed Autodiscovery With YQL with importXML using an XPath of "//link/@href" but I was not getting any results. So [...]


Comments are closed.

Follow

Get every new post delivered to your Inbox.

Join 770 other followers

%d bloggers like this: