mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-04 00:00:37 -04:00
hackernews front page scraper
This commit is contained in:
parent
ae61580a15
commit
0982cafbf9
@ -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
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user