lib/onebox/engine/youku_onebox.rb in onebox-1.7.3 vs lib/onebox/engine/youku_onebox.rb in onebox-1.7.4
- old
+ new
@@ -9,30 +9,23 @@
# 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
match = uri.path.match(/\/v_show\/id_([a-zA-Z0-9_=\-]+)(\.html)?.*/)
- return match[1] if match && match[1]
-
- nil
+ match && match[1]
rescue
- return nil
+ nil
end
def to_html
- "<embed width='570' height='360' src='https://players.youku.com/player.php/sid/#{video_id}/v.swf' wmode='transparent' allowFullScreen='true' quality='high' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash'></embed>"
+ "<embed width='570' height='360' src='https://players.youku.com/player.php/sid/#{video_id}/v.swf' type='application/x-shockwave-flash'></embed>"
end
- def placeholder_html
- to_html
- end
-
private
- # Note: May throw! Make sure to rescue.
def uri
@_uri ||= URI(@url)
end
- end
- end
+ end
+ end
end