Hein (fub) wrote,

  • Mood:

Javascript syndication

OK, so RSS is the syndication format of choice. Lots of blogs and news sites offer RSS feeds, including LiveJournal. If you want to get to the RSS of a Journal, just point your browser to http://www.livejournal.com/users/[user]/rss . Go here to see the RSS of this Journal!

So, RSS. However, RSS is an XML-based format. Which means that you first have to parse it before you can actually do something with it. RSS readers do this, but if you want to put the latest headlines on your own site, you're plain out of luck -- you gotta parse it first!
Tweakers.net, the best Dutch computer 'prosumer'-site has a good solution to the 'parse first, view later' problem: Javascript includes. In your own webpage, you include a piece of Javascript from the tweakers.net webserver that prints out the current headlines with document.write-statements.

Simple and effective: you just embed a small call to that Javascript, and your page now contains the current headlines. That prompted me to experiment a bit with the various Perl modules (HTML::RSS and HTML::Strip, to be precise). I found a script that turns RSS into HTML and adapted it to turn RSS into a Javascript include.
If I expand the script to use a small database and Net::FTP, I can parse many an RSS feed into small Javascript includes that I can use on my own site.

If anyone's interested in the code, give me a holler. Also, I'd be more than willing to host RSS-to-Javascript files for friends.

  • A short test

    If my code works correctly, this entry will be tagged with the music I'm playing on Spotify right now -- scrobbled through last.fm and automatically…

  • Goodbye mobypicture!

    I've been using Mobypicture.com to automatically post photos I took with my G1. However, the photos got resized pretty harshly, they were hosted on…

  • (no subject)

    Just released Benzaiten 0.6.

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded