Skip to content

Instantly share code, notes, and snippets.

@manuels
Created October 27, 2011 19:53
Show Gist options
  • Save manuels/1320677 to your computer and use it in GitHub Desktop.
Save manuels/1320677 to your computer and use it in GitHub Desktop.
oEmbed iframe check script
require 'rubygems'
require 'oembed'
urls =<<URLS
http://www.youtube.com/watch?v=2BYXBC8WQ5k
http://qik.com/video/49565
http://revision3.com/tekzilla/cali-lewis-onstar-review
http://www.hulu.com/watch/293814/the-morning-after-thu-oct-27-2011?promo=thumbnail
http://www.viddler.com/explore/cdevroe/videos/424/
URLS
OEmbed::Providers.register_all()
OEmbed::Providers.register_fallback(OEmbed::ProviderDiscovery)
puts "<ul>"
urls.each_line do |url|
resource = OEmbed::Providers.get(url, {:maxheight => 400, :maxwidth=> 400, :frame => 1, :iframe => 1})
puts "<li><a href='#{url}'>#{resource.provider_name}</a>"
puts resource.html
puts "</li>"
puts
end
puts "</ul>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment