Hello I'm trying to make the crawler read the pages by multiples of 16 (0,16,32 so goes on) but in this test I get stuck in zero only, I know it's basic but I'm an starter in a intership, so please be kind with me. Here's the method:
puts "Crowling #{self.class} on page #{page}" #0
def crawl(url, operation, category)
page = 0
pages= 1
while page < pages do
puts "Crowling #{self.class} on page #{page}"
verdi_page = (page * 16) - 16
html = request(url, verdi_page)
pages = parse_pages(html).max if page == 1
page_properties = parse_properties(html, operation: operation, category:category)
break if page_properties.empty?
properties += page_properties
page += 1
sleep(rand(1..5)) unless Rails.env.test?
end
end
Thanks in advance!
Terminal screenshot: https://imgur.com/a/429UPCs
question from:
https://stackoverflow.com/questions/65644471/rails-crawler-test-loop-itereation-dosenr-work-as-expected 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…