
For those who haven’t yet come across it somewhere on the web, may I recommend checking out the Timeline widget developed by David F. Huynh of the MIT Simile project. It’s a snazzy DHTML/JavaScript tool for visualizing chronological events on a scrollable, graphical timeline — sort of a Google Maps for temporal information.
I’ve been working quite a bit with the Simile widget lately, co-developing (with David Donohue) a module that integrates the widget into Drupal, allowing Drupal sites to display any CCK / Views content as graphical timelines.
Today, inspired by Alexandre Passant’s RSS2Timeline implementation, I sat down to code up a generic web service that can take any Atom or RSS feed and convert it into a JSON-based event source for the Timeline widget. My goal was to make it absolutely trivial to embed live Atom/RSS timelines into blogs and whatnot, so that anyone with basic HTML skills could use timelines without having to go through the relatively complex technical setup the widget requires.
I hereby present the Universal Timeline Aggregator , available at http://timeline.to/ (I’ve been snapping up Tonga’s dot-to domains since getting the ultimate vanity domain, ar.to, as a Christmas present; the “to” preposition works rather nicely for the present purpose, too.)
Here’s a screen capture (and live example, if you click on it) of the sort of timeline display you can create in a minute or two using the timeline.to service:
Timeline view of “recent Ruby on Rails development”:http://dev.rubyonrails.org/timeline.
Embedding a live, interactive Atom or RSS timeline into any site is now as easy as copying and pasting the following HTML snippet, with the appropriate modifications:
<iframe src="http://timeline.to/http://www.mysite.com/rss.xml"
width="500" height="400"
scrolling="no" frameborder="1"
marginwidth="0" marginheight="0"></iframe>
Just replace http://www.mysite.com/rss.xml with a real URL address to an Atom or RSS feed, and modify the width and height as you like. Autodiscovery of feeds is supported to a reasonable extent, so in most cases you won’t even need the exact URL to the feed; the website’s URL address itself will do.
Here’s another example as a screen capture, this time showing the popup box that opens when a timeline event is clicked:
Timeline view of Planet Scheme, showing a preview of a blog entry.
Starting out on the timeline.to implementation today, I had to actually pause a moment to contemplate which technology to use: Python, Ruby or PHP — it wasn’t quite as clear-cut a decision as usual.
Case in point, while I haven’t done much Python coding recently (since defecting to the Ruby camp), the language does have some excellent libraries and frameworks going for it — including arguably the best Atom/RSS parser in existence, the Universal Feed Parser written by Mark Pilgrim. Considering the staggering number of malformed and invalid feeds out there, a good parser is essential (I won’t get further, right this moment, into the delicious irony of having to parse XML formats using regular expressions).
On the other hand, Ruby also has (at least) two relatively comprehensive and decent libraries for feed parsing, FeedTools and Syndication. Unfortunately, in my experience neither library is quite up there with the Universal Feed Parser yet, and neither seems particularly active recently.
In the end, underdog PHP won out on this project on purely practical points: since my Timeline module for Drupal is written in PHP, it makes sense to try and reuse code both ways between the timeline.to service and Drupal.
Investigating the current best way to parse both Atom and RSS feeds with PHP, I learned of a new feed parser library for PHP called SimplePie, which has been gaining a lot of momentum lately (indeed, it seems to be on track for eventually surpassing MagpieRSS as the de-facto RSS parser for PHP). The SimplePie developers are apparently in the process of porting the 3000+ unit tests from Pilgrim’s parser, which certainly seems a promising prospect for creating a truly robust parser.
SimplePie is also bundled with the Feedparser Drupal module, so again, it all just makes sense. The library turned out to be quite painless to work with, and has, so far, been able to parse all the feeds I’ve thrown at it. (I did have to disable SimplePie’s ad-removal feature, as that was eating up the entry descriptions on some Atom feeds.)
Feedback on the timeline.to service is welcome. If there’s sufficient interest, I will consider adding further functionality such as iCalendar support, and perhaps mashup features allowing multiple feeds and data sources to be combined into a single timeline display.