Skip to content

Instantly share code, notes, and snippets.

@matiasinsaurralde
Created August 10, 2014 08:21
Show Gist options
  • Save matiasinsaurralde/146f85b41f1aa73dc088 to your computer and use it in GitHub Desktop.
Save matiasinsaurralde/146f85b41f1aa73dc088 to your computer and use it in GitHub Desktop.
battlehack-teams
require 'nokogiri'
page = Nokogiri::HTML( File.read('teams.html') )
page.xpath("//table[@id='index']/tbody/tr").each do |tr|
tds = tr.xpath(".//td").map { |e| e.inner_text().strip() }
team_name, hack_name, members, team_id = tds[0], tds[1], tds[2], tr.xpath(".//a[position()=1]").attr('href').value.match(/[0-9]+/)[0].to_i
p [team_id, team_name, hack_name, members]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment