diff --git a/lib/oneboxer/whitelist.rb b/lib/oneboxer/whitelist.rb index 392c788dfb5..246a681ba79 100644 --- a/lib/oneboxer/whitelist.rb +++ b/lib/oneboxer/whitelist.rb @@ -1,7 +1,7 @@ #******************************************************************************# # # # Oneboxer already supports most sites using OpenGraph via the OpenGraphOnebox # -# class. If the site you want to create a onebox for supports OpenGraph, # +# class. If the site you want to create a onebox for supports OpenGraph, # # please try adding the site to the whitelist below before creating a custom # # parser or template. # # # @@ -18,8 +18,6 @@ module Oneboxer Entry.new(/^https?:\/\/(?:www\.)?cnn\.com\/.+/), Entry.new(/^https?:\/\/(?:www\.)?washingtonpost\.com\/.+/), Entry.new(/^https?:\/\/(?:www\.)?funnyordie\.com\/.+/), - Entry.new(/^https?:\/\/(?:www\.)?youtube\.com\/.+/), - Entry.new(/^https?:\/\/(?:www\.)?youtu\.be\/.+/), Entry.new(/^https?:\/\/(?:www\.)?500px\.com\/.+/), Entry.new(/^https?:\/\/(?:www\.)?scribd\.com\/.+/), Entry.new(/^https?:\/\/(?:www\.)?photobucket\.com\/.+/), diff --git a/lib/oneboxer/youtube_onebox.rb b/lib/oneboxer/youtube_onebox.rb new file mode 100644 index 00000000000..50e0cf8234d --- /dev/null +++ b/lib/oneboxer/youtube_onebox.rb @@ -0,0 +1,10 @@ +require_dependency 'oneboxer/oembed_onebox' + +module Oneboxer + class YoutubeOnebox < OembedOnebox + matcher /^https?:\/\/(?:www\.)?(?:youtube\.com|youtu\.be)\/.+$/ + def oembed_endpoint + "http://www.youtube.com/oembed?url=#{BaseOnebox.uriencode(@url.sub('https://', 'http://'))}&format=json" + end + end +end