mirror of
https://github.com/discourse/discourse.git
synced 2025-02-16 11:13:06 +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
|