Friday, September 21, 2007

Using Yahoo! Pipes to show actors and directors birth places

I was going through a tutorial that used Google Mashup Editor (GME) to draw locations from a Yahoo! Pipes feed. Please read the tutorial because the rest of my post builds on it.

I wanted to do something different, so I decided to pipe in birth data (places and dates) of movie actors and directors from IMDb. Halfway through the exercise, I realized I didn't even need to use GME to achieve the same effect because the Pipes results page has maps output for all geodata-enabled results. Here's a screenshot of the final product, there's back and forward buttons that you can use to navigate through the list (you can find my Pipe here):


Firstly, let's look at how the original "Born On This Date" feed looks like:


<rss version="0.92">
<channel>
...
<item><title>Maggie Cheung (43)</title>
<link>http://www.imdb.com/rg/rss/BORN/name/nm0001041</link>
<description>In 1964, Maggie Cheung was born on this date in Hong Kong</description></item>
...
</channel>
</rss>

Pretty standard stuff, if you're familiar with RSS feeds. Follow the instructions in the tutorial mentioned above, and you should easily be able to get this feed into Yahoo! Pipes. Here's what my Pipes designer looks like:


You'll notice that the only important thing to do is to create a "place" property. I copied the default description for this, since it contains the city of birth. Then, I applied some regex functions on it to remove unnecessary information. The Location Extractor module will then do the rest; It automagically creates the longitude and latitude properties.

I also tried to create a "date" property, for date of birth, but couldn't get this in the results feed. It looks like Pipes requires properties to comply with the RSS schemas.

Anyway here's what the final processed feed looks like:

<rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
...
<item><title>Maggie Cheung (43)</title>
<link>http://www.imdb.com/rg/rss/BORN/name/nm0001041</link>
<description>In 1964, Maggie Cheung was born on this date in Hong Kong</description>
<guid isPermaLink="false" />
<geo:lat>22.411249</geo:lat>
<geo:long>114.15354</geo:long>
</item>
...
</channel>
</rss>

You could pull this feed into GME and do some pretty funky stuff with the data, like show the actor's or director's filmography and wikipedia article links. But, if you just wanted the results to show on a map interface, you could stop here. If you wanted to take the map with you, heavily customize it, and put it on your own webpage, then you could use Virtual Earth (the interactive SDK rocks). Enjoy!

0 comments: