[RAILS] Scraping for beginners (Ruby)

I did scraping for the first time, It worked, so I'll leave it as my memo.


require 'open-uri'
require 'nokogiri'

url = 'https://www.yahoo.co.jp/'

doc = Nokogiri::HTML(open(url))
doc.css('h1').each do |link|
  puts link.content

Recommended Posts

Scraping for beginners (Ruby)
[Ruby on Rails] About bundler (for beginners)
[Ruby] How to use slice for beginners
Explanation of Ruby on rails for beginners ①
abbreviation for ruby method
[For Ruby beginners] Ruby engineer certification exam Silver/Gold exam notes
Ruby Learning # 23 For Loops
[For beginners] ○○. △△ in Ruby (ActiveRecord method, instance method, data acquisition)
Explanation of Ruby on rails for beginners ⑥ ~ Creation of validation ~
Explanation of Ruby on rails for beginners ② ~ Creating links ~
Explanation of Ruby on rails for beginners ⑦ ~ Flash implementation ~
Java debug execution [for Java beginners]
[Java] Basic statement for beginners
[For super beginners] DBUnit super introduction
(For beginners) [Rails] Install Devise
[For super beginners] Ant super introduction
[Ruby] What is `!!` used for?
More usable Enumerable for beginners
Java for beginners, data hiding
[For super beginners] Maven super introduction
Java application for beginners: stream
Ruby on Rails for beginners! !! Summary of new posting functions
[Procedure 1 for beginners] Ruby on Rails: Construction of development environment
[For Ruby beginners] Explain how to freely delete array elements!
[ruby + excel] Precautions for Save As
Binary Tree Memorandum for Beginners (Part 1)
[For beginners] Summary of java constructor
Rock-paper-scissors game for beginners in Java
Java for beginners, expressions and operators 1
[For beginners] Run Selenium in Java
Links for creating Android apps (for beginners)
Ruby on Rails for beginners! !! Post list / detailed display function summary
Ruby convenience methods for fledgling engineers
[For beginners] Ruby is said to be ruby, but what about it?
Java for beginners, expressions and operators 2
[Folio LSP] Roughly Docker (for beginners)
Notes for Android application development beginners
[For super beginners] Struts2 Super Primer --2018 Edition
[For super beginners] Mirage SQL super introduction
Explanation of Ruby on rails for beginners ⑤ ~ Edit and delete database ~
Object-oriented course for beginners sent by beginners
Recommended learning method for programming beginners
[For beginners] How to get the Ruby delayed railway line name
[For Java beginners] About exception handling
Classes and instances Java for beginners
What you can do with ruby ​​Quick reference teaching materials (for beginners)
How to build a Ruby on Rails environment using Docker (for Docker beginners)
[Ruby] Explanation for beginners of iterative processing with subscripts such as each_with_index!
(For beginners) Swift UI view element collection
Acquisition of article information in ruby ​​scraping
Getting Started with Ruby for Java Engineers
Let's learn SQL SELECT statement for beginners
A memorandum for android application development beginners
Learn Java with "So What" [For beginners]
[For programming beginners] What is a method?
IntelliJ IDEA Convenient function for beginners (importance ★ 4)
[Java + jsoup] Scraping Mercari's products for sale
[For beginners] Difference between Java and Kotlin
[Beginner] Various iterative processing for Ruby arrays
[For super super beginners] What is object orientation?
Rails [For beginners] Implementation of comment function