Unable to scrape data using Nokogiri in Ruby -


i trying scrape data webpage using nokogiri. want scrape data list of service centers link http://www.cardekho.com/maruti/noida/car-service-center.htm

the code have written same is:

require 'open-uri' require 'nokogiri'  doc = nokogiri::html(open("http://www.cardekho.com/maruti/noida/car-service-center.htm"))  doc.css('.delrname').each |node|     puts node.text end 

i have tried bunch of combination of css tags none of them giving desired result.can suggest tag correctly scrape data list of service centers link ?

thanks in advance

ps: same code(with appropriate css tag) when tested on other websites working expected, not working on website.

your code seems work. have removed white spaces in url:

doc = nokogiri::html(open("http://www.cardekho.com/maruti/noida/car-service-center.htm")) 

then have try , output:

$ ruby file.rb                                                                                                                                              fast track auto care india jkm motors mangalam motors motorcraft india motorcraft india rohan motors rohan motors rohan motors vipul motors 

Comments