hackernews front page scraper

This commit is contained in:
HoneyryderChuck 2018-02-28 22:20:17 +00:00
parent ae61580a15
commit 0982cafbf9

View File

@ -9,14 +9,13 @@ html = Oga.parse_html(frontpage)
links = html.css('.itemlist a.storylink').map{|link| link.get('href') }
links = links.select {|l| l.start_with?("https") }
#responses = HTTPX.get(*links)
puts links
responses = HTTPX.get(*links)
links.each_with_index do |l, i|
response = HTTPX.get(l)
#puts "#{l}: #{responses[i].status}"
puts "#{l}: #{response.status}"
puts "#{responses[i].status}: #{l}"
end