Class: Cherrypicker::Googlevideo
- Inherits:
-
PluginBase
- Object
- PluginBase
- Cherrypicker::Googlevideo
- Defined in:
- lib/cherrypicker/plugins/googlevideo.rb
Instance Attribute Summary collapse
-
#download_url ⇒ Object
Returns the value of attribute download_url.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#link ⇒ Object
Returns the value of attribute link.
-
#location ⇒ Object
Returns the value of attribute location.
Class Method Summary collapse
Instance Method Summary collapse
- #download ⇒ Object
-
#initialize(link, opts = {}) ⇒ Googlevideo
constructor
A new instance of Googlevideo.
Methods inherited from PluginBase
Constructor Details
#initialize(link, opts = {}) ⇒ Googlevideo
Returns a new instance of Googlevideo.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cherrypicker/plugins/googlevideo.rb', line 13 def initialize(link, opts={}) o = { :location => nil, }.merge(opts) @link = link @filename = "" @location = o[:location] @download_url = "" response = Cherrypicker::remote_query(@link) @filename = response.body[/<title>(.*)<\/title>/, 1] + ".flv" @download_url = CGI.unescape(response.body[/videoUrl\\x3d(.*)\\x26thumbnailUrl/, 1]) end |
Instance Attribute Details
#download_url ⇒ Object
Returns the value of attribute download_url.
7 8 9 |
# File 'lib/cherrypicker/plugins/googlevideo.rb', line 7 def download_url @download_url end |
#filename ⇒ Object
Returns the value of attribute filename.
7 8 9 |
# File 'lib/cherrypicker/plugins/googlevideo.rb', line 7 def filename @filename end |
#link ⇒ Object
Returns the value of attribute link.
7 8 9 |
# File 'lib/cherrypicker/plugins/googlevideo.rb', line 7 def link @link end |
#location ⇒ Object
Returns the value of attribute location.
7 8 9 |
# File 'lib/cherrypicker/plugins/googlevideo.rb', line 7 def location @location end |
Class Method Details
.matches_provider?(url) ⇒ Boolean
9 10 11 |
# File 'lib/cherrypicker/plugins/googlevideo.rb', line 9 def self.matches_provider?(url) url.include?("video.google.com") end |
Instance Method Details
#download ⇒ Object
29 30 31 |
# File 'lib/cherrypicker/plugins/googlevideo.rb', line 29 def download Cherrypicker::download_file(@download_url, :location => @location, :filename => @filename) end |