0

An rss feed that doesn't seem to work with YQL

Normally if I want to test an rss feed in the console I would put in something like this:

select * from rss where url="http://feeds.huffingtonpost.com/huffingtonpost/LatestNews"

But the above query produces no entries/items.

Why?

by
7 Replies
  • QUOTE (tsummerall @ Apr 11 2009, 11:33 AM) <{POST_SNAPBACK}>
    Normally if I want to test an rss feed in the console I would put in something like this:

    select * from rss where url="http://feeds.huffingtonpost.com/huffingtonpost/LatestNews"

    But the above query produces no entries/items.

    Why?


    The feed appears to be Atom, not RSS. Try this instead:

    select * from atom where url="http://feeds.huffingtonpost.com/huffingtonpost/LatestNews"
    0
  • QUOTE (Ryan Kennedy @ Apr 11 2009, 12:55 PM) <{POST_SNAPBACK}>
    The feed appears to be Atom, not RSS. Try this instead:


    You're exactly right! Thanks!

    This brings up a deeper question. I'm trying to create a way for people to include limited feed-based info on their web pages. I'd like it if these folks didn't have to know whether the feed was RSS 1 or 2 or Atom or whatever. I was hoping YQL would provide an even more generic way to access these feeds in a naive way.

    So is there some way in YQL to say something like

    select * from [you figure it out] where url is "http://..."

    I know a truly generic solution is probably impossible, but surely the system could tell the difference between RSS and ATOM?
    0
  • Select * from xml covers Atom and RSS, but I'm not sure that is going to help with your aim. YQL adds it's own XML wrapper around the original input, which means that the output will not be recognized as a feed. For instance, if I use your original feed, http://feeds.huffingtonpost.com/huffingtonpost/LatestNews , in my browser (Firefox on Windows) the browser recognizes this as a feed and it gets passed to the built-in feed reader. If I use the Atom data source for YQL, the YQL output is not reconized as a feed.
    http://query.yahooapis.com/v1/public/yql?q...&format=xml

    I don't know if Yahoo! Pipes could help you. It can take RSS and Atom input and will try to convert the Atom input so that it can be seen as RSS.
    0
  • That's very helpful, thank you.

    I'll be parsing the data initially myself, so it doesn't matter if it doesn't look like a feed after the xml query.

    So my plan now i to take the result and scan through looking for <item> or <entry> nodes hich I presume should at least work in a limited way for both RSS and ATOM.
    0
  • QUOTE (tsummerall @ Apr 12 2009, 06:54 AM) <{POST_SNAPBACK}>
    You're exactly right! Thanks!

    This brings up a deeper question. I'm trying to create a way for people to include limited feed-based info on their web pages. I'd like it if these folks didn't have to know whether the feed was RSS 1 or 2 or Atom or whatever. I was hoping YQL would provide an even more generic way to access these feeds in a naive way.

    So is there some way in YQL to say something like

    select * from [you figure it out] where url is "http://..."

    I know a truly generic solution is probably impossible, but surely the system could tell the difference between RSS and ATOM?


    We already have this today :-) wrapped in a table called "feed" (not surprising). It accepts the various types of feeds we support; both atom and rss

    select * from feed where url = 'http:///...'

    We reason we introduced this table for the exact case that you mention. In addition you can also pass in multiple feeds via a subselect like so:

    select * from feed where url in ('http://rss..', 'http://atom')

    http://developer.yahoo.com/yql/console/?q=...LatestNews'

    -- Nagesh
    0
  • QUOTE (Nagesh Susarla @ Apr 12 2009, 11:08 PM) <{POST_SNAPBACK}>
    We already have this today :-) wrapped in a table called "feed" (not surprising). It accepts the various types of feeds we support; both atom and rss

    select * from feed where url = 'http:///...'

    Thanks Nagesh!

    I'm not seeing a big advantage from "feed" vs. "xml" because you still have to know that, for example, in the RSS you get an array of "item" objects whereas in ATOM you get an equivalent array of "entry" objects. Though I suppose in the "feed" output you can iterate through whatever array happens to be the contents of the "results" member.

    Is it always that structure?
    0
  • QUOTE (tsummerall @ Apr 13 2009, 06:05 AM) <{POST_SNAPBACK}>
    Thanks Nagesh!

    I'm not seeing a big advantage from "feed" vs. "xml" because you still have to know that, for example, in the RSS you get an array of "item" objects whereas in ATOM you get an equivalent array of "entry" objects. Though I suppose in the "feed" output you can iterate through whatever array happens to be the contents of the "results" member.

    Is it always that structure?


    Yes. Thats always the structure. I'd use "xml" if I had use for other elements such as rss/channel information etc but use the "feed" table if I just wanted all xpaths pointing to eithe items or entries.

    -- Nagesh
    0

Recent Posts

in YQL