I did scraping for the first time, It worked, so I'll leave it as my memo.
yahoo_scrape.rb
require 'open-uri'
require 'nokogiri'
url = 'https://www.yahoo.co.jp/'
doc = Nokogiri::HTML(open(url))
puts
doc.css('h1').each do |link|
puts link.content
end
Recommended Posts