Created
December 15, 2020 23:16
-
-
Save merrillcook0/0f298ef461b0c38a5c623d9baf47bcd7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
require 'open-uri' | |
html_data = open('https://www.nytimes.com/2020/06/15/technology/restaurants-coronavirus.html').read | |
nokogiri_object = Nokogiri::HTML(html_data) | |
related_posts = nokogiri_object.css("div.recirculation > h3 > a") | |
related_posts.each do |related_post| | |
puts related_post.text | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment