lib/oembedr/providers.rb in oembedr-0.0.2 vs lib/oembedr/providers.rb in oembedr-0.0.3

- old
+ new

@@ -1,11 +1,11 @@ module Oembedr module Providers # from ruby-oembed with a couple more I know of from user feedback :). LIST = { - /(yotu\.be|youtube)/ => "http://www.youtube.com/oembed", + /(youtu\.be|youtube)/ => "http://www.youtube.com/oembed", /(flic\.kr|flickr)/ => "http://www.flickr.com/services/oembed/", /viddler/ => "http://lab.viddler.com/services/oembed/", /qik/ => "http://qik.com/api/oembed.{format}", /revision3/ => "http://revision3.com/api/oembed/", /hulu/ => "http://www.hulu.com/api/oembed.{format}", @@ -17,20 +17,26 @@ /blip\.tv/ => "http://blip.tv/oembed/", /opera\.com/ => 'http://my.opera.com/service/oembed', /skitch\.com/ => 'http://skitch.com/oembed', /twitch\.tv/ => false, # OMG! Support OEmbed! /twitter\.com/ => 'https://api.twitter.com/1/statuses/oembed.{format}', + /dailymotion\.com/ => 'http://www.dailymotion.com/api/oembed/', + /scribd\.com/ => 'http://www.scribd.com/services/oembed', + /dotsub\.com/ => 'http://dotsub.com/services/oembed', + /clikthrough\.com/ => 'http://clikthrough.com/services/oembed', + /kinomap\.com/ => 'http://www.kinomap.com/oembed', + /photobucket\.com/ => 'http://photobucket.com/oembed' # ... } # Locate the correct service endpoint for the given resource URL. # # @param url [String] a fully-qualified URL to an oembeddable resource # # @return the url, or false if no known endpoint. def service_endpoint url endpoint = LIST.find do |(pattern, endpoint)| - pattern.match(url) + url =~ pattern end endpoint ? endpoint.last : false end # Return a boolean true or false if we can handle the given domain \ No newline at end of file