Reputation: 19
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
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