Class: Onebox::Engine::YoukuOnebox

Inherits:
Object
  • Object
show all
Includes:
Onebox::Engine, HTML
Defined in:
lib/onebox/engine/youku_onebox.rb

Instance Attribute Summary

Attributes included from Onebox::Engine

#errors, #options, #timeout, #uri, #url

Instance Method Summary collapse

Methods included from Onebox::Engine

all_iframe_origins, engines, included, #initialize, origins_to_regexes, #placeholder_html

Instance Method Details

#to_htmlObject



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/onebox/engine/youku_onebox.rb', line 22

def to_html
  <<~HTML
    <iframe
      src="https://player.youku.com/embed/#{video_id}"
      width="640"
      height="430"
      frameborder='0'
      allowfullscreen
    ></iframe>
  HTML
end

#video_idObject



15
16
17
18
19
20
# File 'lib/onebox/engine/youku_onebox.rb', line 15

def video_id
  match = uri.path.match(%r{/v_show/id_([a-zA-Z0-9_=\-]+)(\.html)?.*})
  match && match[1]
rescue StandardError
  nil
end