Allow Youtube onebox with start time. All params are used in the youtube onebox now.

This commit is contained in:
Neil Lalonde 2013-10-09 11:40:10 -04:00
parent 4a0b17bb16
commit acca220380
2 changed files with 11 additions and 3 deletions

View File

@ -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\/.+/),

View File

@ -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