Aniket
Aniket

Reputation: 19

Rails scraping of price

I am developing a rails app in that I have to scrape the price from the link but unable to do so link

mechanize=Mechanize.new
     page = mechanize.get('url') 
     doc=page.parser
     #seller price
     puts doc.css('div.olpOffer div.a-span2 span.currencyINRFallback').text

Upvotes: 0

Views: 153

Answers (1)

Beengie
Beengie

Reputation: 1608

The price was nested in the span above.

mechanize=Mechanize.new
  page = mechanize.get('http://www.amazon.in/gp/offer-listing/B00WER132G/ref=olp_page_1?ie=UTF8&qid=1448947981&sr=1-12') 
  doc=page.parser
  #seller price
  puts doc.css('div.olpOffer div.a-span2 span.olpOfferPrice').text

Per pguardiarit's comment..

mechanize=Mechanize.new
page = mechanize.get('http://www.amazon.in/gp/offer-listing/B00WER132G/ref=olp_page_1?ie=UTF8&qid=1448947981&sr=1-12')
#seller price  
puts page.css('div.olpOffer div.a-span2 span.olpOfferPrice').text

Upvotes: 1

Related Questions