Proof that engineers at Yahoo! have a sense of humour

12 Oct 2008

Last week I attended the absolutely excellent Future of Web Apps conference at London Excel. Of the many great talks, I picked up this little nugget from Christian Heilmann of Yahoo!.

Yahoo! very kindly support a wide range of data formats for people to query their sites with. For instance, if you look at Flickr and get the feed for my photostream, but default you get a url, which returns the feed in RSS format:

iver[mdales]% curl 'http://api.flickr.com/services/feeds/photos_public.gne?
id=68497070@N00&lang=en-us&format=rss_200' | head -20
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
        xmlns:media="http://search.yahoo.com/mrss/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:flickr="urn:flickr:" >
<channel>
<title>Uploads from Michael Dales</title>
<link>http://www.flickr.com/photos/mdales/</link>
<description></description>
<pubDate>Wed, 8 Oct 2008 12:55:44 -0800</pubDate>
<lastBuildDate>Wed, 8 Oct 2008 12:55:44 -0800</lastBuildDate>
<generator>http://www.flickr.com/</generator>
<image>
<url>http://farm1.static.flickr.com/164/buddyicons/
68497070@N00.jpg?1174985061#68497070@N00</url>
<title>Uploads from Michael Dales</title>
<link>http://www.flickr.com/photos/mdales/</link>
</image>
...

However, you can replace the “rss_200” bit with other formats, such as Atom, JSON, or PhP. For example:

curl 'http://api.flickr.com/services/feeds/photos_public.gne?
id=68497070@N00&lang=en-us&format=json' | head -20
jsonFlickrFeed({
"title": "Uploads from Michael Dales",
"link": "http://www.flickr.com/photos/mdales/",
"description": "",
"modified": "2008-10-08T19:55:44Z",
"generator": "http://www.flickr.com/",
"items": [
   {
"title": "Buell under the sun",
"link": "http://www.flickr.com/photos/mdales/2925291652/",
"media": {<a href=""http://farm4.static.flickr.com/3123/">m</a>
2925291652_45cdbfaf2b_m.jpg"},
"date_taken": "2008-09-23T15:45:06-08:00",
"description": "<p><a href=&quot;http://www.flickr.com/people/mdales/...
"published": "2008-10-08T19:55:44Z",
"author": "nobody@flickr.com (Michael Dales)",
"author_id": "68497070@N00",
"tags": "uk england motorbike ulysses buell wirral westkirby"
   },
   {
"title": "Light shaft",
...

This is all fantastic, but Yahoo! have been clever – they’ve looked at the way the Internet is going, and see that soon we’ll all be using the one true format, and so are supporting it early:

iver[mdales]% curl 'http://api.flickr.com/services/feeds/photos_public.gne?
id=68497070@N00&lang=en-us&format=lol' | head -20
HAI
IM IN UR BUCKETS MAKING UP FORMATS
GIMME UPLOADS FROM MICHAEL DALES
I CAN HAS PHOTO BUELL UNDER THE SUN
ITZ AT http://www.flickr.com/photos/mdales/2925291652/
INVISIBLE METADATA
LOL
KTHX.
I CAN HAS PHOTO LIGHT SHAFT
ITZ AT http://www.flickr.com/photos/mdales/2903429761/
INVISIBLE METADATA
LOL
KTHX.
I CAN HAS PHOTO LIVERPOOL ONE
ITZ AT http://www.flickr.com/photos/mdales/2901492810/
INVISIBLE METADATA
LOL
KTHX.
I CAN HAS PHOTO ULYSSES HDR
ITZ AT http://www.flickr.com/photos/mdales/2859929061/
...

Certainly LOL was a lot easier to format to fit on my blog :)