lib/onebox/engine/youku_onebox.rb in onebox-2.0.2 vs lib/onebox/engine/youku_onebox.rb in onebox-2.1.0
- old
+ new
@@ -5,10 +5,11 @@
class YoukuOnebox
include Engine
include HTML
matches_regexp(/^(https?:\/\/)?([\da-z\.-]+)(youku.com\/)(.)+\/?$/)
+ requires_iframe_origins "https://player.youku.com"
# Try to get the video ID. Works for URLs of the form:
# * http://v.youku.com/v_show/id_XNjM3MzAxNzc2.html
# * http://v.youku.com/v_show/id_XMTQ5MjgyMjMyOA==.html?from=y1.3-tech-index3-232-10183.89969-89963.3-1
def video_id
@@ -17,10 +18,17 @@
rescue
nil
end
def to_html
- "<embed width='570' height='360' src='https://players.youku.com/player.php/sid/#{video_id}/v.swf' type='application/x-shockwave-flash'></embed>"
+ <<~HTML
+ <iframe src="https://player.youku.com/embed/#{video_id}"
+ width="640"
+ height="430"
+ frameborder='0'
+ allowfullscreen>
+ </iframe>
+ HTML
end
private
def uri