Class: FindArt::JunoDownload
- Defined in:
- lib/FindArt/scrapers/junodownload.rb
Instance Method Summary collapse
Methods inherited from Scraper
#find_art, register_scraper, registerd_sites, #scrapers, unregister_scrapers!
Instance Method Details
#scrape(artist, title, opts = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/FindArt/scrapers/junodownload.rb', line 6 def scrape(artist,title,opts={}) url = nil browser = WWW::Mechanize.new browser.get(@@url) do |page| # go to search form search = page.form_with(:action => 'http://www.junodownload.com/search/') do |f| f.q = "#{artist} #{title}" end. doc = Hpricot(search.body) element = doc.at('.productcover img[@src^="http://cdn.images.juno.co.uk/75/"]') src = nil if !element.nil? src = element.attributes['src'] # instead of cliking on the image to find the uri of the larger image we will replace some parts of the url # lets hope junodownload keeps this convention src.gsub!("/75/","/full/") src.gsub!("-TN","-BIG") url = src end end url end |