Class: Onebox::Engine::YoukuOnebox

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

Constant Summary

Constants included from Onebox::Engine

DEFAULT

Instance Attribute Summary

Attributes included from Onebox::Engine

#cache, #timeout, #url

Instance Method Summary collapse

Methods included from Onebox::Engine

engines, included, #initialize, #options, #options=

Instance Method Details

#placeholder_htmlObject



25
26
27
# File 'lib/onebox/engine/youku_onebox.rb', line 25

def placeholder_html
  to_html
end

#to_htmlObject



21
22
23
# File 'lib/onebox/engine/youku_onebox.rb', line 21

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>"
end

#video_idObject



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

def video_id
  match = uri.path.match(/\/v_show\/id_([a-zA-Z0-9_=\-]+)(\.html)?.*/)
  return match[1] if match && match[1]

  nil
rescue
  return nil
end