Module: Rlastfm::Helpers::Scraper::ProtectedClassMethods

Defined in:
lib/rlastfm/helpers/scraper.rb

Instance Method Summary collapse

Instance Method Details

#doc_for(url_or_path) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/rlastfm/helpers/scraper.rb', line 18

def doc_for(url_or_path)
  url_or_path = URI.parse(url_or_path)
  url = url_or_path.relative? ? last_fm_uri(url_or_path.to_s).to_s : url_or_path

  if Rlastfm.debug
    puts "Releasing scraper on: #{url}"
  end

  doc = Hpricot open(url)
end

#last_fm_uri(path) ⇒ Object



14
15
16
# File 'lib/rlastfm/helpers/scraper.rb', line 14

def last_fm_uri(path)
  URI::HTTP.build :host => "www.last.fm", :path => path
end