Answer the question
In order to leave comments, you need to log in
Parser in Ruby?
Guys need help. I wrote a parser on the site, but it collects data from one page, how to make it go to another page and collect data further? I can show the script code
Answer the question
In order to leave comments, you need to log in
Parse links in the code and add them to the job queue for subsequent parsing.
For not very complex parsing, open-uri and nokogiri are enough.
In a loop, you sort through your array with the necessary pages and save all the links.
array_of_pages.each_with_index do |page_for_parsing, index|
urls[index] = "http://www.site.com/#{page_for_parsing}"
end
urls.each_with_index do |url_for_parsing, index|
page = open urls[index]
doc = Nokogiri::HTML(page)
doc.css('.class').each do |stuff|
# Обрабатываем информацию
end
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question