Skip to content

Instantly share code, notes, and snippets.

@davidcornu
Created January 19, 2017 00:32
Show Gist options
  • Save davidcornu/c2d0b325bba267aaa91ee4ac2012310f to your computer and use it in GitHub Desktop.
Save davidcornu/c2d0b325bba267aaa91ee4ac2012310f to your computer and use it in GitHub Desktop.
source "https://rubygems.org"
gem 'oga'
GEM
remote: https://rubygems.org/
specs:
ansi (1.5.0)
ast (2.3.0)
oga (2.8)
ast
ruby-ll (~> 2.1)
ruby-ll (2.1.2)
ansi
ast
PLATFORMS
ruby
DEPENDENCIES
oga
BUNDLED WITH
1.13.6
require 'open-uri'
require 'oga'
(1970..1990).each do |year|
body = URI("http://www.meertens.knaw.nl/nvb/topnamen/land/Nederland/#{year}").open.read
doc = Oga.parse_html(body)
doc.css('#topnamen-jongens tr').each do |row|
next unless row.text.include?('Willem')
puts "##{row.css('td')[0].text} in #{year}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment