Steve M
Steve M

Reputation: 75

jQuery External RSS Feed Parser?

I've been looking around for a decent jQuery feed/XML parser and found good plugins like jFeed and jParse (among a few others). None of these support retrieving an external feed though, which is something I'm after.

Pretty sure this is down to jQuery's $.ajax() method rather than the plugins themselves (as they'll be built from this).

Is there some sort of hack I could use to override jQuery, or a raw JavaScript alternative? Better still would be a better plugin, but even the more popular ones I found didn't support it.

Thanks

Upvotes: 3

Views: 10057

Answers (6)

fevangelou
fevangelou

Reputation: 324

I recently built AMJR (Asynchronous Multifeed JS Reader) cause I couldn't find something similar to what you ask...

AMJR was written to cover a specific need: A multi-feed reader written in JS. In other words, a feed reader that takes multiple feeds as input and outputs the last X from all the feeds in chronological order. An implementation you'll surely find in server-side languages but not in JS! Having such a functionality reside on the user's browser (client-side) can lift off some processing load especially on high-traffic sites which happen to integrate external feeds. Think of AMJR as your own "Yahoo Pipes" widget to mashup feeds altogether in the same output block.

To summarize things for AMJR:

  • It can fetch multiple feeds at once while sorting them at the same time chronologically.
  • It's simple to implement, small in size and fast to load.
  • It's non-blocking (asynchronous). This means that the browser will continue to load the rest of the page while feeds are loading.
  • It can handle a sh** load of feeds, but the resulting performance depends on your user's internet connection download speed. In this example I've deliberately chosen to fetch a ridiculous number of external feeds (150+) so you can see a) the non-blocking process and b) how fast it is.
  • Feeds are "proxied" via Google's infrastructure (or optionally via Yahoo's YQL), where they get "normalized" and then converted to (compressed) JSON before being sent back to the user's browser.
  • Built on jQuery but the dependency is so small you can easily adapt it to work with Mootools, YUI etc.
  • It works on all modern browsers.

Info/download at: http://nuevvo.com/labs/amjr/

Enjoy!

Upvotes: 2

Lasse Christiansen
Lasse Christiansen

Reputation: 10325

I can only recommend jFeed. I use a fork of it ( https://github.com/uhlenbrock/jfeed ) together with my phonegap project. The fork adds support for parsing the creator tag, and it works perfectly out of the box.

Upvotes: 0

Jesse Burcsik
Jesse Burcsik

Reputation: 367

jFeed has a php proxy. I just had this need and jFeed was able to retrieve an external. PLease edit your comment if NOT using php is a requirement.

ANSWER (From what we know): Use jFeed!

:: However I just found out if your feed is 'not well-formed' it will break jFeed. :: Be warned

Upvotes: 0

Steve M
Steve M

Reputation: 75

The answer looks to be on this page, using YQL instead of my own PHP proxy to handle the requests.

http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/

After finding out that it's not possible to do a simple JavaScript call to handle these requests, this jQuery plugin looks ideal, going to try it out later.

In fact, for parsing of RSS feeds without jQuery you can use the Google AJAX Feed API. Works a treat.

http://code.google.com/apis/ajaxfeeds/examples.html

Thanks for the replies

Upvotes: 1

amercader
amercader

Reputation: 4540

If by retrieving an external feed you mean getting a feed from a different domain that the one your web application is, you can't (Same origin policy).

You will need some kind of proxy on the server side, like a PHP or python script (or whatever your favorite language is) that queries the external feeds and returns their contents to your application.

The jFeed plugin you checked has an example of a PHP proxy.

Upvotes: 0

Related Questions