Class: VgDalealplay
Instance Method Summary collapse
- #download_url ⇒ Object
- #duration ⇒ Object
- #embed_html(width = 425, height = 344, options = {}, params = {}) ⇒ Object
- #embed_url ⇒ Object
-
#initialize(url = nil, options = {}) ⇒ VgDalealplay
constructor
A new instance of VgDalealplay.
- #parse_url(url) ⇒ Object
- #service ⇒ Object
- #thumbnail ⇒ Object
- #title ⇒ Object
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, ={}) @url = url @video_id = parse_url(@url) @page = Nokogiri::HTML(open(@url)) end |
Instance Method Details
#download_url ⇒ Object
38 39 40 |
# File 'lib/acts_as_unvlogable/vg_dalealplay.rb', line 38 def download_url nil end |
#duration ⇒ Object
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 (width=425, height=344, ={}, params={}) "<iframe frameborder='0' marginwidth='0' marginheight ='0' id='videodap' scrolling='no' width='#{width}' height='#{height}' src='#{}'></iframe>" end |
#embed_url ⇒ Object
26 27 28 |
# File 'lib/acts_as_unvlogable/vg_dalealplay.rb', line 26 def @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 |
#service ⇒ Object
42 43 44 |
# File 'lib/acts_as_unvlogable/vg_dalealplay.rb', line 42 def service "dalealplay" end |
#thumbnail ⇒ Object
22 23 24 |
# File 'lib/acts_as_unvlogable/vg_dalealplay.rb', line 22 def thumbnail @page.xpath("//meta[@itemprop='thumbnailUrl']").first["content"] end |
#title ⇒ Object
18 19 20 |
# File 'lib/acts_as_unvlogable/vg_dalealplay.rb', line 18 def title @page.xpath("//h1").first.text end |