mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Allow Youtube onebox with start time. All params are used in the youtube onebox now.
This commit is contained in:
parent
4a0b17bb16
commit
acca220380
@ -1,7 +1,7 @@
|
|||||||
#******************************************************************************#
|
#******************************************************************************#
|
||||||
# #
|
# #
|
||||||
# Oneboxer already supports most sites using OpenGraph via the OpenGraphOnebox #
|
# 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 #
|
# please try adding the site to the whitelist below before creating a custom #
|
||||||
# parser or template. #
|
# parser or template. #
|
||||||
# #
|
# #
|
||||||
@ -18,8 +18,6 @@ module Oneboxer
|
|||||||
Entry.new(/^https?:\/\/(?:www\.)?cnn\.com\/.+/),
|
Entry.new(/^https?:\/\/(?:www\.)?cnn\.com\/.+/),
|
||||||
Entry.new(/^https?:\/\/(?:www\.)?washingtonpost\.com\/.+/),
|
Entry.new(/^https?:\/\/(?:www\.)?washingtonpost\.com\/.+/),
|
||||||
Entry.new(/^https?:\/\/(?:www\.)?funnyordie\.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\.)?500px\.com\/.+/),
|
||||||
Entry.new(/^https?:\/\/(?:www\.)?scribd\.com\/.+/),
|
Entry.new(/^https?:\/\/(?:www\.)?scribd\.com\/.+/),
|
||||||
Entry.new(/^https?:\/\/(?:www\.)?photobucket\.com\/.+/),
|
Entry.new(/^https?:\/\/(?:www\.)?photobucket\.com\/.+/),
|
||||||
|
10
lib/oneboxer/youtube_onebox.rb
Normal file
10
lib/oneboxer/youtube_onebox.rb
Normal 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
|
Loading…
Reference in New Issue
Block a user