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.



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

def initialize(url=nil, options={})
  @url = url
  @video_id = parse_url(@url)
  @page = Nokogiri::HTML(open(@url))
end

Instance Method Details

#download_urlObject



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

def download_url
  nil
end

#durationObject



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

def duration
  nil
end

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



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

def embed_html(width=425, height=344, options={}, params={})
  "<iframe frameborder='0' marginwidth='0' marginheight ='0' id='videodap' scrolling='no' width='#{width}' height='#{height}' src='#{embed_url}'></iframe>"
end

#embed_urlObject



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

def embed_url
  @page.xpath("//meta[@itemprop='embedUrl']").first["content"]
end

#parse_url(url) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/acts_as_unvlogable/vg_dalealplay.rb', line 46

def parse_url(url)
  uri = URI.parse(url)
  path = uri.path
  videoargs = ''
  if path
    videoargs = path.split('_')[-1]
    raise unless videoargs.size > 0
  else
    raise
  end
  videoargs
rescue
  nil
end

#serviceObject



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

def service
  "dalealplay"
end

#thumbnailObject



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

def thumbnail
  @page.xpath("//meta[@itemprop='thumbnailUrl']").first["content"]
end

#titleObject



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

def title
  @page.xpath("//h1").first.text
end