Class: VgDalealplay

Inherits:
Object show all
Defined in:
lib/acts_as_unvlogable/vg_dalealplay.rb

Instance Method Summary collapse

Constructor Details

#initialize(url = nil, options = {}) ⇒ VgDalealplay

Returns a new instance of VgDalealplay.



11
12
13
14
15
# File 'lib/acts_as_unvlogable/vg_dalealplay.rb', line 11

def initialize(url=nil, options={})
  @url = url
  @video_id = @url.query_param('con')
  @page = Hpricot(open(url))
end

Instance Method Details

#download_urlObject



41
42
43
# File 'lib/acts_as_unvlogable/vg_dalealplay.rb', line 41

def download_url
  nil
end

#durationObject



29
30
31
# File 'lib/acts_as_unvlogable/vg_dalealplay.rb', line 29

def duration
  nil
end

#embed_html(width = 425, height = 344, options = {}) ⇒ Object



33
34
35
# File 'lib/acts_as_unvlogable/vg_dalealplay.rb', line 33

def embed_html(width=425, height=344, options={})
  "<object type='application/x-shockwave-flash' width='#{width}' height='#{height}' data='#{embed_url}'><param name='quality' value='best' />	<param name='allowfullscreen' value='true' /><param name='scale' value='showAll' /><param name='movie' value='http#{embed_url}' /></object>"
end

#embed_urlObject



25
26
27
# File 'lib/acts_as_unvlogable/vg_dalealplay.rb', line 25

def embed_url
  @page.search("//link[@rel='video_src']").first.attributes["href"].sub("autoStart=true", "autoStart=false")
end

#flvObject



37
38
39
# File 'lib/acts_as_unvlogable/vg_dalealplay.rb', line 37

def flv
  "http://videos.dalealplay.com/contenidos3/#{CGI::parse(URI::parse(embed_url).query)['file']}"
end

#serviceObject



45
46
47
# File 'lib/acts_as_unvlogable/vg_dalealplay.rb', line 45

def service
  "dalealplay"
end

#thumbnailObject



21
22
23
# File 'lib/acts_as_unvlogable/vg_dalealplay.rb', line 21

def thumbnail
  "http://images-00.dalealplay.com/contenidos2/#{@video_id}/captura.jpg"
end

#titleObject



17
18
19
# File 'lib/acts_as_unvlogable/vg_dalealplay.rb', line 17

def title
  (Iconv.iconv 'utf-8', 'iso-8859-1', @page.search("//title").inner_html.split(" - www.dalealplay.com")[0]).to_s
end