API Responses as Feeds

You know three things that would be cool?

  • the ability to subscribe to the output of a Flickr API call in a feed aggregator
  • the ability to get the results of Flickr API calls as KML (or GeoRSS)
  • if all those devices that support RSS feeds (like photo frames!) also supported the Flickr API.

You see where I’m going with this don’t you?

You can already specify that you want the output format of a Flickr API call to be REST (POX), XML-RPC, SOAP (shudder, not sure that one still works), JSON, or serialized PHP. We always wanted to support formats like KML, or Atom but we were never quite sure how to represent the results of a call to flickr.photos.getInfo() or flickr.photos.licenses.getInfo() as a KML.

Last week we finally got around to pushing out our 80% solution — an experimental response format for API methods that use the standard photos response format that allows you to request API responses as as one of our many feed formats.

You can now get the output of flickr.photos.search(), or flickr.favorites.getList() as Atom, or GeoRSS, or KML, or whatever.

API Feed Types

The syntax is "&format=feed-{SOME_FEED_IDENTIFER}" where the feed identifiers follow the same convention you use when fetching…feeds.

  • feed-rss_100, API results will be returned as a RSS 1.0 feed
  • feed-rss_200, API results will be returned as a RSS 2.0 feed
  • feed-atom_10, API results will be returned as a Atom 1.0 feed
  • feed-georss, API results will be returned as a RSS 2.0 feed
    with corresponding GeoRSS and W3C Geo elements for geotagged
    photos
  • feed-geoatom, API results will be returned as a Atom 1.0 feed
    with corresponding GeoRSS and W3C Geo elements for geotagged
    photos
  • feed-geordf, API results will be returned as a RSS 1.0 feed
    with corresponding GeoRSS and W3C Geo elements for geotagged
    photos
  • feed-kml, API results will be returned as a KML 2.1 feed
  • feed-kml_nl, API results will be returned as a KML 2.1 network
    link feed

And remember, format is an API arg, and needs to be included in your API signature if you’re making a signed API call.

Namespaces, pagination, bits and bobs

You’ll find the feeds now include the venerable xmlns:flickr=”urn:flickr:” namespace. This is used to declare bits that don’t fit elsewhere like pagination.

Pagination information is passed as a single namespaced (‘urn:flickr:)
element under the feed’s root (or “channel” element if it has one). For
everything but RSS 1.0 based feeds it looks like this:

<flickr:pagination total="480" page="1" pages="96"
per_page="5" />

For RSS 1.0 we do a little RDF dance:

<flickr:flickr>
     <pagination>
             <total>480</total>
             <page>1</page>
                 <pages>32</pages>
             <per_page>15</per_page>
     </pagination>
</flickr:flickr>

Speaking of pagination, to start with we’ve enforced a maximum “per
page” limit of 15. If people have a reasonable use case we may
consider raising the limit but otherwise we need to account for the
extra data/size that feed formats add.

You’ll also find some extras like

<entry>
    ...
    <flickr:views>3</flickr:views>
    <flickr:original type="png" href="http://farm4.static.flickr.com/3074/2783931781_12f84e4079_o.png" width="640" height="480" />
</entry>

Error Handling

If an error occurs, the API will return a 400 HTTP status code.

Flickr error codes and message are returned as X-FlickrErrCode and X-FlickrErrMessage
HTTP headers. For example:

X-FlickrErrCode: 111
X-FlickrErrMessage: Format "feed-lolcat" not found

Caveats and Warnings

  • This is EXPERIMENTAL. It might change, it might go away, but we hope not. We also could potentially make it better based on all your awesome feedback.

  • This is not available for all methods. If you call photos.getInfo and
    ask for a feed response format all you will get is an error.

  • Just like any API call (or feed usage or really anything else) you are required to respect the copyright of the photographer.

  • These are still API calls. All the usual rules about usage apply.
    You are still bound by the Flickr API TOU and any other rules,
    capricious or not, we apply to API usage. Including rate limits. If
    you feed this in to an overly-aggressive aggregator we will make your
    API key cry. (In an entirely non-creepy way)

Putting it together: ego feeds

Turns out ‘kellan’ is a popular baby name these days, so whenever I go ego surfing Flickr I tend to see pictures of two year olds. This changes (for now) when I limit my searching to my friends photos. Using API feeds I can now build an ego feed of photos from my friends, like so:

flickr.photos.search:
   user_id => 51035734193@N01,
   contacts => all,
   text => kellan,
   sort => date-posted-desc,
   api_key => {API_KEY}
   auth_token => {AUTH_TOKEN}
   format => feed-atom_10

api.flickr.com/services/rest/?auth_token=xxxx&user_id=51035734193%40N01&
   contacts=all&format=feed-atom_10&sort=date-posted-desc&text=kellan
   &api_key=xxxx&method=flickr.photos.search&api_sig=xxxx

Putting it together: near home

Or a KML feed of the most interesting, safe, CC licensed photos, within 10 kilometers of a point (say your home), suitable for remixing:

flickr.photos.search:
   license => 1,2,4,5,7,
   sort => interestingness-desc,
   lat => 40.661699,
   lon => -73.98947,
   radius => 10,
   safe_search => 1,
   api_key => {API_KEY}
   format => feed-kml

api.flickr.com/services/rest/?auth_token=xxx&license=1%2C2%2C4%2C5%2C7&
  lat=40.661699&lon=-73.98947&radius=10&safe_search=1
  &format=feed-atom_10&api_key=xxxx&method=flickr.photos.search
  &api_sig=xxxxx

You get the idea.

Standard Photos Response, APIs for a civilized age.

Funny story. I went to write a blog post and when the time came to link to the documentation of our standard “standard photos response” structure, I found we had never documented it!

Okay. Maybe that wasn’t so funny.

But anyway, this is the blog post before that other blog post, so that when I write that other blog post I’ve got something to point to.

And besides you should know this stuff if you’re using the API. It’s good stuff.

Standard Photos Response

The standard photos response is a data structure that we use when we want to return a list of photos. Most prominently the ever popular swiss-army-API flickr.photos.search() uses it, but also methods like flickr.favorites.getList() or flickr.groups.pools.getPhotos().

Beyond a common structure that gets serialized across all our different API response formats, standard photos response methods share a common set of arguments for sorting and paging (after all these are lists of photos), and the special extras argument.

Standard Photo Response, the XML Serialization

You’re basic standard photos response looks like this. It’s just an envelope for delivering a list of photos.

<rsp stat="ok">
  <photos page="1" pages="7" perpage="100" total="608">
    <photo id="2777191844" owner="51035734193@N01" secret="653a19d017" server="3059" farm="4" title="FAIL" ispublic="1" isfriend="0" isfamily="0"/>
    <photo id="2771521705" owner="51035734193@N01" secret="1878507379" server="3178" farm="4" title="In the street" ispublic="1" isfriend="0" isfamily="0"/>
  </photos>
</rsp>

We’ve got the standard Flickr <rsp> root element, a <photos> container describing the full list and the page we’re on, and some <photo> elements that include everything we need to display a photo.

extras: the concept

Another largely undocumented deep structure in the Flickr API is a distinction between getList() and getInfo() methods. We tend to return a pared down list of identifiers, and provide methods for getting more info about individual items. Generally it’s a very useful pattern, and saves us all bandwidth, processing, and data rot.

However sometimes (often?) you’re wanting to display a bunch of photos, and having to roundtrip to call flickr.photos.getInfo() for every single one of them is annoying. (not to mention slow, and likely to get you frowned upon by our ops team)

That’s where extras come in. The idea behind extras is you can selectively enrich the bare bones list I showed you earlier with the metadata you need to display your bunch of photos, without the round trip, and without fetching more then you’ll need.

extras: the details

There are currently 13 different extras available, and we add new ones periodically as new concepts come online, or you make a compelling enough case for them.

As of today they are: license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags, o_dims, views, media.

license

Is the photo “All rights reversed”? Licensed under one of the CC license?

<photo id="2777191844" owner="51035734193@N01" secret="653a19d017"
 server="3059" farm="4" title="FAIL" ispublic="1" isfriend="0" isfamily="0" 
 license="3"/>

license=”3” means Attribution-NonCommercial-NoDerivs, you can get our mappings with flickr.photos.licenses.getInfo().

date_upload, date_taken, last_update

When was the photo uploaded to Flickr? When do we think it was taken? When was its metadata last twiddled?

<photo id="2772368826" owner="51035734193@N01" secret="1078392104"
 server="3122" farm="4"       title="Finger on the button" ispublic="1" isfriend="0" isfamily="0"
 license="3"  dateupload="1219006901" datetaken="2008-08-17 12:38:06" 
datetakengranularity="0"     lastupdate="1219117103"/>

Yes the extras param is called date_upload the attribute is dateupload, what can I say, legacy. Notice also that dateupload and lastupdate are epoch seconds, while datetakengranularity is probably best ignored.

owner_name and icon_server

Everything you need to properly credit the photographer, including their name, and the info necessary to display their buddyicon.

<photo id="2772368826" owner="51035734193@N01" secret="1078392104" 
server="3122" farm="4" title="Finger on the button" ispublic="1" isfriend="0" isfamily="0" 
ownername="kellan" iconserver="54" iconfarm="1"/>

geo

If the photo was geotagged include the latitude, longitude, and accuracy of the geotagging.

<photo id="2772368826" owner="51035734193@N01" secret="1078392104" 
server="3122" farm="4" title="Finger on the button" ispublic="1" isfriend="0" isfamily="0" 
latitude="40.714666" longitude="73.957333" accuracy="16"/>

tags and machine_tags

Note these are the “clean” versions of the tags and machine tags, which means spaces, and most punctuation will have been stripped. Safe to display in HTML, and useable as URL fragments.

<photo id="2772368826" owner="51035734193@N01" secret="1078392104" 
server="3122" farm="4" title="Finger on the button" ispublic="1" isfriend="0" isfamily="0" 
tags="nyc streetart williamsburg ph:camera=iphone3g" 
machine_tags="ph:camera=iphone3g"/>

original_format and o_dims

Assuming you’re making API calls as a member who is authorized to download a photo (e.g. the photographer) you can ask for details about the unmodified, full resolution photo that was uploaded. Get the original file format, the secret needed to construct the URL to the photo, and what the original’s dimensions are.

<photo id="2772368826" owner="51035734193@N01" secret="1078392104" 
server="3122" farm="4" title="Finger on the button" ispublic="1" isfriend="0" isfamily="0" 
originalsecret="xxxxxxxx" originalformat="jpg" o_width="1200" 
o_height="1600"/>

views

How many times has this photo been viewed by folks other then the person who uploaded it?

<photo id="2772368826" owner="51035734193@N01" secret="1078392104" 
server="3122" farm="4" title="Finger on the button" ispublic="1" isfriend="0" isfamily="0" 
views="9"/>

media

Is it a photo? Or a video? Has it been processed and is it ready for displaying? (media_status is a lot more useful for videos)

<photo id="2771521705" owner="51035734193@N01" secret="1878507379" 
server="3178" farm="4" title="In the street" ispublic="1" isfriend="0" isfamily="0" 
media="photo" media_status="ready"/>

Wow. What a list. Really, what more could anyone ever want? (that’s rhetorical)

The punch line

That’s standard photos responses, and how to use extras (paging and sorting is left as an exercise to the reader). Mastering the format is the key to building both interesting and performant API applications. use the metadata, love the metadata, and ditch the round trip.

And now for the that next blog post I mentioned ….

Wildcard Machine Tag URLs

Machine tags!

Photo by cackhanded

If you’re not already familiar with machine tags the easiest way to think of them is being like a plain old tag but with a special syntax that allows users to define additional structured data about that tag. In turn the magic space hamsters that run the site have been trained to recognize, index and allow for searches across multiple facets of a given machine tag.

Machine tags have three parts : a namespace which is like a subject or a topic; a predicate which is a like a property of that topic; a value which is … well, a value.

For a more thorough introduction to the subject I’d recommend reading the announcement
we made in the Flickr API discussion group
when machine tags were first added to the site. If you’d like to know even more, after that, there is good collection of links available on del.icio.us.

Which brings us to the part where I tell you that we’ve added the ability to search for machine tagged photos in plain old tag URLs (as well as in tag searches on the Flickr search page) using the facetted query syntax that has always been available in the API. For example :

That’s a trick, really. You’ve always been able to do this since machine tags are just
tags. The New-New means you can be even more granular in what you are looking
for. How about :

The wildcard URL syntax is also available for an individual user’s tags :

Now for the list of caveats and Known-Knowns :

  • At the moment it is still not possible to poke around the hierarchy of a given machine tag : all the predicates for a namespace; all the unique pairs of namespace and predicates; that sort of thing. It is On The List ™ and hopefully we can offer up something for you to play with, even if it’s just in the API to start with, shortly.

  • Values in wildcard URLs should are treated the same way regular tags are in URLs. That is “san francisco” becomes “sanfrancisco” or in machine tag speak : *:*=sanfrancisco.

  • In the examples above, I’ve illustrated namespaces that are used to denote one service or another. It is important to remember that there are no rules about what can or should be a namespace. Like tagging, the hope is that the various communities will arrive at and adapt a consensus according to their needs.

  • Untitled Souvenir #1173678685

    Photo by straup

    In the meantime, kick back and enjoy photos taken by people on their Dopplr trips, photos by people who really really like airplanes or photos by people who are interested in possums
    (not to mention all manner of marsupials) or whatever else comes to mind!

Trickr, or Humanising the Developers (Part 2)

Back for more, my wee little tin miners? As we say ’round these parts, Onwards!

But first thanks to Rafe, and Stephen for playing along.

[flickr_staff_buddy_icon name=mylesdgrant]
Myles, POWER USER!
Testing on dev is for the unconfident.

Macbook Pro, Textmate, scp, Firefox, Firebug, ack, Quicksilver, iTerm, vi, Mail.app.

[flickr_staff_buddy_icon name=norby]
Norby, Ops Succubus
Sleep! What is it with you people and sleep?

  • Y!-issue MBP (upgraded to Leopard w/ spaces)
  • Terminal, ssh, Safari, Firefox, Nagios, vi
  • tunnels >> VPN, have more than one RSA key if you work remotely :)

[flickr_staff_buddy_icon name=laloyd]
Paul L, Roaming (not Roman) Yeti
Gngghhhghghhh

MacBook Pro, JDK 1.6, IntelliJ Idea 7.03, iTerm, one reliable crazy Canadian-Russian.

[flickr_staff_buddy_icon name=schill]
Schill, Lil’ Javascript charmer
[ This space left intentionally blank ]

MBP, TextMate, A-grade (Fx/Safari/Opera) browsers, IE 6/7/8 + MS Script debugger via Parallels. GIMP for the odd image edit. Dell 24″.

Fun stuff: Beyerdynamic DT-880 headphones, iTunes + last.fm + SOMA FM for muzak. Finger rocket defense system. Grande dark roast in the AM.

[flickr_staff_buddy_icon name=sm]
Serguei, Ex-KGB Field Agent
Comments are lying, code tells the truth!

PC laptop. JDK 1.6, IntelliJ Idea 7.03, FAR manager, SecureCRT ssh client. kill, especially in its most radical form kill -9. And tail -f , I can watch logs for hours, it’s better than TV.

[flickr_staff_buddy_icon name=hitherto]
Simon, Totally bi(linguisticalated)
Um, no, that won’t work in French

  • MBP
  • Textmate
  • Firefox 3
  • Safari
  • Parallels (for testing in IE)
  • Apple Terminal
  • Apple Mail
  • Quicksilver

grep, vi, perl, dozens of bash shortcuts. and my personal favourite for code review : “cvs diff | mate”

Visualizing 4.5 years of Flickr development

We were impressed with Michael Ogawa’s code_swarm project, so were understandably excited when he made the source available (under the GPL v3). We sprang into action, avoiding the real work we were supposed to be doing and created some visualizations of the main Flickr subversion repository.

In this visualization, blue represents PHP, green is HTML, red is Java, purple is CSS and JavaScript, Cyan is Flash and ActionScript, with yellow filling in for everything else.

Myles took it a step further, using the tool to visualize our internal bug tracking system. In this movie, each node represents an issue, flashing red as it was opened, orange as it was assigned, blue as we argued about what to do and final green when it was resolved.

This required a little modification of the software to allow for states on nodes, so that the node color can change as the state changes. Myles has also been working on some modifications to improve upon the abrupt endings. New movies might get posted here if they’re awesome enough.

We’re hard at work (well, sort-of-work) thinking up new things to visualize and new ways to present the data. If you have some bright ideas, why not post them in the code forum.

Trickr, or Humanising the Developers (Part 1)

We busy little nerds of Flickr may act and smell like a bunch of psychotic monkey-bots, but beneath our filth-drenched metal exteriors beat the fleshy hearts of a thousand delicate human flowers. We feel, we love.

Ever wondered what keeps us well-oiled? I did, so I asked people, “What do you use to get the job done?”

And this, my dubious friends, is how we (rick)roll.

[flickr_staff_buddy_icon name=straup]
Aaron, Ce sera mauvais français parce que j’ai utilisé l’Internet
You’re still wrong

  • Emacs (dired-mode and shell-mode and M-x goto-line)
  • Glimpse (and alias grep grep -n -r -e)
  • Tabs and virtual workspaces

[flickr_staff_buddy_icon name=bees]
Cal, Baconmeister
Fuck off and die

  • shitty pc laptop w/ xp pro
  • twin 20″ monitors
  • noted
  • explorer
  • ff & thunderbird
  • putty / pageant / plink
  • winscp
  • cygwin
  • msys & mingw
  • wireshark
  • paint shop pro 5
  • miranda
  • calc & chamap
  • tortoise cvs/svn
  • beyond compare
  • apache/mysql/php
  • ms office w/ visio
  • itunes

[flickr_staff_buddy_icon name=revdancatt]
Dan, The Rev.
I don’t do quotes

2 Machine setup;

MacBook Pro for writing code, TextWrangler (off-white Lucida Grande 11pt font on blue background, for reduced eye-strain), Safari & Opera for (final) testing.

PC for testing, with IE6,7,blah + MS Script debugger. Most testing takes place in Firefox + Firebug (cannot live without firebug). Monitor rotated 90 degrees to give Firebug more real estate for hacking around the dom, editing js script on the fly, etc.

Extras:

[flickr_staff_buddy_icon name=dunstan]
Dunstan, He’s like, got a dog and stuff
Mistakenly included on the engineering mailing list for 505 days and counting

  • Macbook Pro
  • Textmate
  • Photoshop
  • Transmit
  • Safari
  • Firefox+Firebug
  • IE (in Parallels)
  • Quicksilver

[flickr_staff_buddy_icon name=eric]
Eric, Teenage Mutant Ninja Scripta
Please, just work

Powerbook, BBEdit, Perl scripts to manage scp+cvs+Flex+compression, Firefox w/ Firebug and Webdev toolbar, Flex 3 SDK, Terminal, nano, Parallels.

[flickr_staff_buddy_icon name=kellan]
Kellan, Rebellious off-worlder
I’d rather be building cloud castles

MBP, a hot-rodded version of Textmate, QuickSilver+Terminal.app (what’s the Finder?), Thunderbird + keyconfig for threading and archiving, SSHKeychain, grep, awk, tree, QuickProxy for Firefox (2.x), WordPress.com, last.fm, Pandora, and Adium. used to use PHPfi, but less lately.

[flickr_staff_buddy_icon name=murphy_slaw]
Murphy, Secret ops mole
… –force –yes –quiet > /dev/null 2>&1

  • MacBook Pro
  • iTerm
  • vim, kill, screen, awk, rsync, mtr, nmap, strace, gdb
  • Wireshark
  • SSH Agent
  • Thunderbird + Enigmail
  • Firefox + Firebug + SwitchProxy + Nagios Checker
  • Adium
  • Caffeine
  • Home Zone

Coming soon: more responses!

Flickr at XTech (and slides from SXSW…)

Once upon a time, webheads used to talk about “conference season”, but it seems that these days there’s always a conference running somewhere. Having dispensed with Web 2.0, we’re now turning our attention to XTech 2008, which takes place in Dublin, Ireland from Tuesday May 6th to Friday May 9th.

The Flickr team has two talks lined up for those attending XTech. Through a freak scheduling accident they’re back-to-back, giving attendees the exciting opportunity to experience one and a half straight hours of pure Flickr-related goodness:

Hopefully we’ll see some of you there!

Looking backwards for a moment, this is also a chance to re-post the slides from my previous internationalization-themed talk, “Taking Over the World, The Flickr Way” which I gave at South by Southwest in March. This hour-long session was a high-level overview of some of the challenges and solutions we stumbled upon during the internationalization and localization of Flickr.com which we undertook in the first half of 2007:

Versions of the slides in other formats (keynote, swf, pdf) are available here.

As for Web 2.0 Expo, some of the team’s presentations should be showing up here in the next week or so, starting with slides from the delectable John Allspaw.

Videos in the Flickr API

It isn’t just you, the pictures really did start moving, some of them at least. Which is an attempt at humor to cover the fact that this post is very belated.

Presumably you’ve noticed that folks are uploading videos to Flickr, and you’re wondering how to work with video in the API? I’ll try to recap, and expand upon the info in this thread in the API group.

Long Photos

First thing to understand is as far as Flickr is concerned videos are just a funny type of photo. Your API application can ignore that video exists and everything should go on working. This means:

  • you can display a preview of a video by treating it exactly like any other photo on Flickr.
  • photos AND videos are returned by any method which used to return just photos
  • you can get info about a video like you would a photo.

Videos, photos, and “media”

If you’re calling one of the dozens of API methods including flickr.photos.search() and … that return what we call a “standard photo response” then that API method takes an “extras” argument. extras is a comma separated list of additional metadata you would like included in the API response.

With the launch of video we’ve added a new extra: “media”. Included media in your list of requested extras and we’ll include a new attribute media=photo or media=video with each photo element. Like so:

<photo id="2345938910" owner="35468159852@N01" secret="846d9c1be9" server="1423" farm="2" title="Naughty Dandelion" ispublic="1" isfriend="0" isfamily="0" media="video"/>

Additionally if you’re calling flickr.photos.search() you can filter your results by media type by passing `media=photos` or `media=videos` as an additional search argument. (not to be confused with the extras of the same name)

Default is “media=both” returning both photos and videos.

Displaying videos: just funny photos

For each uploaded video we generate a JPG preview in a range of sizes. Identical to what we do for photos.

Read the documentation for flickr.photos.getSizes() to get you started on how to display Flickr photos.

Playing videos: constructing the embed code

We don’t currently provide a way to get to the FLV for a video. (the Flash encoded video file) We’re looking into making this possible. In the mean time if you want to display watch-able videos you’ll need to embed our video player.

In addition to the photo height and width of the preview images, videos also have a stream height and stream width which we set when we process videos during upload. While you can make the video player any size you want the videos are going to look much better if displayed at the proper size.

You can get the stream height and stream width and the URL for the video player using the standard flickr.photos.getSizes() method:

<sizes canblog="1" canprint="1" candownload="1">
<size label="Square" width="75" height="75" source="http://farm2.static.flickr.com/1423/2345938910_846d9c1be9_s.jpg" url="http://www.flickr.com/photos/revdancatt/2345938910/sizes/sq/" media="photo"/>
... standard getSizes stuff ...
<size label="Video Player" width="500" height="375" source="http://www.flickr.com/apps/video/stewart.swf?v=49235&photo_id=2345938910&photo_secret=846d9c1be9" url="http://www.flickr.com/photos/revdancatt/2345938910/" media="video"/>
</sizes>

Alternately the stream width and height are included in the new video element returned by flickr.photos.getInfo()
:

...
<video ready="1" failed="0" pending="0" duration="14" width="500" height="375" />
</photo>
....

Generating Embed Code

The player takes a height, a width, a photo id, a photo secret (required for playing non-public videos), and the argument flickr_show_info_box, which when set to layers over top of the video videographer, and video title info when the video isn’t playing.

I’m not going to go over in depth the markup for the player, but here is a quick and dirty PHP function for generating it:

#
# takes a "Video Player" source from flickr.photos.getSizes() and optional display arguments
#

function flickr_video_embed($video_url, $width="400", $height="300", $info_box="true") {

    $markup = <<<EOD
<object type="application/x-shockwave-flash" width="$width" height="$height" data="$video_url"  classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"> <param name="flashvars" value="flickr_show_info_box=$info_box"></param> <param name="movie" value="$video_url"></param><param name="bgcolor" value="#000000"></param><param name="allowFullScreen" value="true"></param><embed type="application/x-shockwave-flash" src="$video_url" bgcolor="#000000" allowfullscreen="true" flashvars="flickr_show_info_box=$info_box" height="$height" width="$width"></embed></object>
EOD;
    return $markup;

}

Videos in the feeds

Videos, unsurprisingly, are included in all of the various RSS and Atom feeds which contain photos. For each video entry we include a MediaRSS content element that points to the SWF player, and has a content type of “application/x-shockwave-flash”. Additional we include the stream height and width as the height and width elements in the content element.

In RSS 2.0 feed we also include an enclosure element.

Uploading Videos

Upload videos just like you would a photo. We’ll do the magic to figure out whether the uploaded file is a video or a photo. You’ll generally want to use the asynchronous upload methods as videos tend to be larger, and take more time to upload.

Videos need to be “transcoded” — turned into an FLV which is playable on the Web. As this takes time videos aren’t always immediately available for viewing. You can check the processing status of a video using flickr.photos.getInfo(), and examining the video element.

<video ready="1" failed="0" pending="0" duration="14" width="0" height="0"/>

ready is watchable, pending is still being transcoded, and failed videos need to be re-uploaded. (possibly in a different format)

More Questions?

We’ve got an open thread in the Flickr API group discussing video.