Skip to content

Instantly share code, notes, and snippets.

@dolisy
dolisy / courrier_international_article.rb
Created July 18, 2017 16:40
Displays all articles available on Courrier International by title, and asks the user to select one. The selected article will be presented to the user to be read.
require "open-uri"
require "nokogiri"
def articles(link)
result = []
articles = []
doc = Nokogiri::HTML(open(link))
nodeset = doc.css('a')
articles = nodeset.map { |element| element["href"] }.compact
articles.each do |article|