Home

django-oembed is awesome


Have I mentioned that django-oembed is awesome? oEmbed is a data exchange protocol that content providers (Flickr, YouTube, Digg, Revision3, Vimeo, et cetera) can supports that lets you programatically determine how best to display their content. oEmbed is an open standard that was spearheaded by Leah Culver of Pownce and she made a post on the subject when the project was announced.

Imagine this scenario: You’ve got the URL to a YouTube video. You can link to that page easily enough, but what you really want to do is embed that video on your blog. How do you do that? You can go to the YouTube page and ferret out the proper embed codes, but those are different for every site.

To embed content from Vimeo or Rev3 is different than from Youtube and Viddler. oEmbed lets each of these services run an oEmbed endpoint into which you pass a URL resource and get back an XML response with all the necessary information for embedding the content.

Even more fantastic than oEmbed is django-oembed, a small Django project by Eric Florenzano. It contains a few data models and fixtures that define a pretty good set of content providers and their endpoints. The real meat is in the {% oembed %} tag that you can wrap around a URL and which pops out the correct embed codes!

You might’ve noticed the tag stuck into my last post because I’m now using it to embed YouTube videos in my tumble/lifestream page sourced from FriendFeed & django-friendly.