Rails 抓取价格

Rails scraping of price

我正在开发一个 rails 应用程序,因为我必须从 link 中获取价格但无法这样做 link

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

价格嵌套在上面的跨度中。

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

根据 pguardiarit 的评论..

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