December 17th, 2005
This script is capable of taking an RSS (or Atom) feed and converting it into a valid JSON object. I currently cache feed requests once per hour, to save on bandwidth - so keep that in mind when developing an application.
You can use the interface that I have setup, below, or you can download the script itself (written in Perl) and run it on your own server (which is preferable).
Interface
This script currently has a REST interface, accessible via a GET request. The full request would look something like this:
GET http://ejohn.org/apps/rss2json/?url=URL&callback=CALLBACK
the URL parameter would contain the URL of the RSS/Atom feed which you are attempting to convert. The optional Callback parameter would reference a callback function that you wish to have called, with the new data.
You can test this out by visiting the following URL:
http://ejohn.org/apps/rss2json/?url=http://ejohn.org/index.rdf
Sample Code and Demo
A simple, sample, program would look something like this:
getRSS
("http://digg.com/rss/index.xml", handleRSS
);
function handleRSS(rss) {
alert( "Dowloaded: " + rss.title );
}
function getRSS(url, callback) {
feedLoaded = callback;
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = "http://ejohn.org/apps/rss2json/?url=" + url
+ "&callback=feedLoaded&t=" + (new Date()).getTime();
document.getElementsByTagName("head")[0].appendChild(script);
}
I've also setup a more advanced demo, which uses some tweaked code from the del.icio.us JSON page.
Also, the del.icio.us popular widget that I made using the Google Homepage API also uses the RSS to JSON convertor. Taking a quick peak at the source code shows it in use.
Download
If you wish to run your own copy of the RSS to JSON script, you can download it from here. It's a Perl-based CGI script which requires that the following modules be installed: LWP and XML::Feed.
This work is licensed under a Creative Commons Attribution 2.5 License.
Tags: javascript, json, perl, rss, convert
16 Comments on 'RSS to JSON Convertor'
April 20th, 2005
This tool goes through your current Google Search History, grabs all of your recent searches and turns it into an RSS feed. Would work best set up as a nightly/hourly cron job, redirecting to a file.
This tool is written in Perl and uses a few, slick, modules: WWW::Mechanize, XML::LibXML, and XML::RSS. I was influenced by the very nice webscrape tool when building this.
A sample, from my searches, can be found here:
http://ejohn.org/apps/ghistory/google.rdf
And how it looks in my newsreader (Newsgator):

Downloads
Tags: perl, google, search, rss, popular
8 Comments on 'Google Search History RSS'
January 14th, 2005
A bug existed in XML::RSS version 1.05 that would only allow a single instance of a 'category' element within a Channel or Item element, which is not in accordance with the specification. I resolved it with a simple patch.
Links
Downloads
Tags: module, perl, rss, xml
Comment on 'Bug Fix in XML::RSS'
October 1st, 2004
The script scrapes the Yahoo TV web site and converts the results into an RSS feed. You can set the station, channel, and duration in the future.
Additionally, I've set up the script, publically, so that anyone can use it. It can be found a the URL below. The configurable options are:
- s=STATION_ID - This is provided by Yahoo, it will look something like this: us_NY31666d.
- c=CHANNEL_ID - This is also provided by Yahoo, and will look something like this: us_COMEDY
- d=DURATION - This is how far in the future you would like the feed to grab, in hours. Defaults to 1.
Links
Downloads
Tags: convertor, perl, rss, scrape, tv
Comment on 'TV2RSS'
October 1st, 2004
This application makes a request to a POP mail folder and converts the found messages into an RSS feed, for easy reading in an RSS reader.
A copy has been made publically available for all to use on my web site, a link is located below. The options are as follows:
- n = Number of messages. Defaults to 20.
- u = POP Username.
- p = POP Password.
- h = POP Host.
Link
Download
Tags: perl, email, convertor, pop3, rss, popular
8 Comments on 'Pop2RSS'
June 8th, 2003
Grabs the current TV listings from the AMC web site and makes them into an RSS feed. Kind of buggy at this point, as they've change the site design around a number of times.
Downloads:
Tags: perl, rss, scrape, tv
Comment on 'AMC 2 RSS'