Class: Onebox::Engine::YoukuOnebox
- Inherits:
-
Object
- Object
- Onebox::Engine::YoukuOnebox
- Includes:
- Onebox::Engine, HTML
- Defined in:
- lib/onebox/engine/youku_onebox.rb
Constant Summary
Constants included from Onebox::Engine
Instance Attribute Summary
Attributes included from Onebox::Engine
Instance Method Summary collapse
- #to_html ⇒ Object
-
#video_id ⇒ Object
Try to get the video ID.
Methods included from Onebox::Engine
all_iframe_origins, engines, included, #initialize, #options, #options=, origins_to_regexes, #placeholder_html
Instance Method Details
#to_html ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/onebox/engine/youku_onebox.rb', line 22 def to_html " <iframe src=\"https://player.youku.com/embed/\#{video_id}\"\n width=\"640\"\n height=\"430\"\n frameborder='0'\n allowfullscreen>\n </iframe>\n HTML\nend\n" |
#video_id ⇒ Object
Try to get the video ID. Works for URLs of the form:
15 16 17 18 19 20 |
# File 'lib/onebox/engine/youku_onebox.rb', line 15 def video_id match = uri.path.match(/\/v_show\/id_([a-zA-Z0-9_=\-]+)(\.html)?.*/) match && match[1] rescue nil end |