Anatomy of a Hack
Last Thursday we had another hackathon at FeedBurner -- our fourth -- which is always an event to look forward to. This one was a lot of fun and there are some really cool hacks that are live right now. My hack was an "Event Feed" service, and I thought I'd write up a bit more information about how it works and how I hope publishers might use it.
First of all, like most good ideas, the idea for this one came from one of our publishers. This suggestion came from Jon Morris (Matis). He keeps his upcoming performances in upcoming.org and wanted a way to display the events on different web sites.
At first, it seems like this should be easy. Upcoming.org has feeds, and FeedBurner has BuzzBoost (not to mention several other widgety tools). Should be able to just burn the feed and choose BuzzBoost, right? Well, not quite. For some arcane reasons, the dates associated with the items are not the event dates, but instead represent when the event was added to upcoming.org. Turns out, that's not terribly useful for most feed consumers. Fortunately, they include other elements in the feed using the xCal namespace that includes information like the event date and location.
Enter the "Event Feed" service at FeedBurner. When you activate this service on the "Optimize" tab at FeedBurner, you're saying that the source feed represents a series of events and that you want them treated that way. So, what FeedBurner does for each item is:
- Find the event date and make that the item date
- Put the items in ascending date order (optionally only including future events), and
- Optionally prepend the event date in the item title
So far, so good. But I don't use upcoming.org ... I happen to use Google Calendar. And what good is a hack if it's not useful to the author?!? So, the Event Feed service will also work with public and private Google Calendars. You just have to find the RSS feed for the particular calendar you want, which can be a bit of a challenge sometimes. Hint: it's somewhere on the Calendar Settings page.
This will work for both shared and private calendars ... let's see how it works. Here's a public calendar: Chicago Bulls schedule. If you look at the feed, you can see it's not terribly helpful: events are totally unordered and it includes past games as well as future games. So, let's burn it and add the Event Feed service. Ah, much better. Here's a nice little headline animator for it as well:
Finally, after staring at those nice upcoming.org feeds complete with event location information, I couldn't resist tossing a FeedFlare into the mix. This was literally cobbled together in 10 minutes right before the end of the day -- I love how easy it is to create these things. Anyway, here it is: Map Event FeedFlare. Take a look: it's just examining the item and looking for the lat and long elements and the venue name, then composing a URL to Google Maps with that information in it. This is actually a good example of how you can use XPath to pull arbitrary information from other namespaces out of a feed item and use them in your FeedFlare. Here's an example of a feed that's using that FeedFlare: source feed, burned feed. And here's what it looks like in as a SpringWidget:
I hope you enjoyed this behind the scenes look at this hack. I had a great time building it and I can't wait to see what people do with it!