lib/onebox/engine/vimeo_onebox.rb in onebox-1.8.88 vs lib/onebox/engine/vimeo_onebox.rb in onebox-1.8.89
- old
+ new
@@ -2,11 +2,12 @@
module Engine
class VimeoOnebox
include Engine
include StandardEmbed
- matches_regexp(/^https?:\/\/(www\.)?vimeo\.com\/\d+(\/[^\/]+)?$/)
+ # only match private Vimeo video links
+ matches_regexp(/^https?:\/\/(www\.)?vimeo\.com\/\d+\/[^\/]+?$/)
always_https
WIDTH ||= 640
HEIGHT ||= 360
@@ -15,9 +16,13 @@
"<img src='#{image_src}' width='#{WIDTH}' height='#{HEIGHT}' #{og_data.title_attr}>"
end
def to_html
video_src = og_data.video_secure_url || og_data.video_url
+ if video_src.nil?
+ id = uri.path[/\/(\d+)/, 1]
+ video_src = "https://player.vimeo.com/video/#{id}"
+ end
video_src = video_src.gsub('autoplay=1', '').chomp("?")
<<-HTML
<iframe width="#{WIDTH}"
height="#{HEIGHT}"
src="#{video_src}"