mirror of
https://github.com/discourse/discourse.git
synced 2025-01-31 12:46:14 +08:00
11 lines
319 B
Ruby
11 lines
319 B
Ruby
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
|