Class: WWW::VideoScraper::AdultSatellites
- Defined in:
- lib/www/video_scraper/adult_satellites.rb
Instance Attribute Summary
Attributes inherited from Base
#embed_tag, #page_url, #thumb_url, #title, #video_url
Instance Method Summary collapse
Methods inherited from Base
#initialize, scrape, url_regex, valid_url?
Constructor Details
This class inherits a constructor from WWW::VideoScraper::Base
Instance Method Details
#scrape ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/www/video_scraper/adult_satellites.rb', line 10 def scrape html = http_get(@page_url) doc = Hpricot(html.toutf8) raise FileNotFound unless flashvars = doc.at('//object //param[@name="FlashVars"]') flashvars = CGI.parse(flashvars.attributes['value']) @video_url = flashvars['videoName'][0] uri = URI.parse(@page_url) if m = @video_url.match(%r!/([[:alnum:]]+/[[:alnum:]]+)\.flv!) @thumb_url = "#{uri.scheme}://#{uri.host}/captured/#{m[1]}_1.jpg" end @title = doc.at('//strong[@class="ptitle"]').inner_html rescue nil if = doc.at('//input[@name="embed"]') @embed_tag = CGI.unescapeHTML(.attributes['value']) end end |