Skip to content

Instantly share code, notes, and snippets.

@metavida
Created January 31, 2011 23:54
Show Gist options
  • Save metavida/805092 to your computer and use it in GitHub Desktop.
Save metavida/805092 to your computer and use it in GitHub Desktop.
Registering providers with the ruby-oembed gem
require 'rubygems'
require 'oembed'
OEmbed::Providers.register(OEmbed::Providers::Youtube)
OEmbed::Providers.get("http://www.youtube.com/watch?v=2BYXBC8WQ5k").html #=> expected HTML
OEmbed::Providers.get("http://vimeo.com/19231255").html #=> An OEmbed::NotFound error
OEmbed::Providers.register(OEmbed::Providers::Vimeo)
OEmbed::Providers.get("http://vimeo.com/19231255").html #=> expected HTML
OEmbed::Providers.get("http://www.viddler.com/explore/engadget/videos/2378/").html #=> An OEmbed::NotFound error
OEmbed::Providers.register_all
OEmbed::Providers.get("http://www.viddler.com/explore/engadget/videos/2378/", :format=>:json).html #=> expected HTML
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment