Answer the question
In order to leave comments, you need to log in
How to get the value of each 3-element?
Guys, hello!
Here is the code I wrote:
require 'nokogiri'
require 'open-uri'
url = 'https://zakupki.gov.ru/epz/order/extendedsearch/results.html'
document = Nokogiri::HTML(URI.open(url))
document.css('div.data-block__value').each do |link|
0.step(link.content.length, 2) do |v|
puts link.content[v]
end
end
values = soup.find_all('div', class_='data-block__value')
for i in range(2, len(values), 3):
print(values[i])
Answer the question
In order to leave comments, you need to log in
document.css('div.data-block__value').each_with_index do |link, i|
puts link.content[v] if (i + 1) % 3 == 0
end
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question