15 Jul

New Open Source Project: OptionStrict.oEmbed

My friend, former colleague, and fellow Elegant Coder, Cory Isakson, has graciously allowed me to open source his .NET oEmbed library. Cory and I have been using this library for about two years, and a derivative of the library has been in production at an internet media company for nearly as long.

The library is hosted on GitHub at:


As far as I know, there is only one other open-source oEmbed library available for .NET. It is written in VB.NET and is hosted on CodePlex at:


For the uninitiated:

oEmbed is a format for allowing an embedded representation of a URL on third party sites.

The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.


Now, what does that mean?

Third-parties, such as YouTube, Flickr, Hulu, GrooveShark, CNN, etc. have resources that you want to embed on your site.

There are different types of resources you can embed:

  • Photo: represents static photos
  • Video: represents playable videos
  • Link: represents generic data (i.e., a link to the author’s site or downloadable content)
  • Rich: any other type not represented above

You send a web request to the API URL of the provider with the url of the resource, and the provider sends you a response with metadata about the resource as well as representations of the resource.

Let’s get a video of the skit SNL’s “Undercover Celebrity Boss” from Hulu.

To get the resource, I need the API and Resource URL’s…

API: http://www.hulu.com/api/oembed.{format}

Resource: http://www.hulu.com/watch/131076/saturday-night-live-undercover-celebrity-boss

Now, if I click on the resource link, I go to Hulu, but I want to embed the video in my site.

To do that, I make a request to Hulu’s oEmbed API, like so:


That request returns the following (notice how I asked for a specific size):
[gist id=1085627]

To embed this in my page, I just need to add the html embed code I received to my page.

OptionStrict.oEmbed attempts to make this process a little more streamlined, giving you the ability to consume oEmbed streams, as well as provide an oEmbed API endpoint. More to come!

One thought on “New Open Source Project: OptionStrict.oEmbed”

  1. Thanks Rich for taking this thing public.  Glad to give others opportunity to use the library and hoping they will offer some suggestions and code for improvement. 

    One of the design goals I went for was no 3rd party libraries.  I hate tool libraries that have additional dependencies.  OptionStrict.oEmbed therefore handles the JSON and XML serialization manually to meet the spec.  Other libraries require a JSON serializer.

    It also offers spec rules validation allowing the developer to trap API calls and discover where things may have gone wrong.  You will find many oEmbed providers are sloppy with their implementations.  Don’t stand for that.  Let them know they our not compliant with the spec. 

    Don’t forget to check out http://embed.ly  They offer the best oEmbed API out there and witha single API endpoint they cover many sites that have no API endpoints of their own.

Comments are closed.