From: Atomic Bomb Date: 2010-12-10T05:43:22+09:00 Subject: Help with net/http I am trying to screen scrape a webpage and pull out the name, address, city, state, zip and phone on a site that lists apartments for rent. Here is my code: ------------------------ temparray = Array.new url = URI.parse("http://www.apartment-directory.info") res = Net::HTTP.start(url.host, url.port) {|http| http.get('/connecticut/0') } # puts res.body res.body.each_line {|line| line.gsub!(/\"/, '') temparray.push(line) if line =~ //,'') j.gsub!(/\shref=\/map\//,'') j.gsub!(/\d+\sclass=map>Map\ \;It!/,'') j.gsub!(/<\/td>/,'') j.gsub!(//, '') j.gsub!(//, '') j.gsub!(//, '
') j.gsub!(/MapIt!/, ', ') j.gsub!(/\(/, ', (') j.gsub!(/<\/tr>/,'') puts j } end ---------------------- I am able to grab the HTML from the page, I then gsub! out a " sign then push each line that starts with between records. Is there a better way to pull out the pertinent info and avoid all the HTML tags? thanks atomic -- Posted via http://www.ruby-forum.com/.