Class: Libertree::Embedding::CustomProviders::Youku

Inherits:
Object
  • Object
show all
Defined in:
lib/libertree/embedding/custom-providers.rb

Class Method Summary collapse

Class Method Details

.formatObject



28
29
30
# File 'lib/libertree/embedding/custom-providers.rb', line 28

def self.format
  %r{http://v\.youku.com/v_show/id_(.+)\.html}
end

.get(url) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/libertree/embedding/custom-providers.rb', line 32

def self.get(url)
  m = url.match self.format
  if m
    return "<embed src=\"http://player.youku.com/player.php/sid/\#{m[1]}/v.swf\" allowFullScreen=\"true\" quality=\"high\" width=\"480\" height=\"400\" align=\"middle\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\"></embed>\n"
  else
    raise Libertree::Embedding::Error, "failed to extract video id"
  end
end