Skip to content

Instantly share code, notes, and snippets.

@pjaspers
Created May 11, 2010 08:14
Show Gist options
  • Save pjaspers/397058 to your computer and use it in GitHub Desktop.
Save pjaspers/397058 to your computer and use it in GitHub Desktop.
Getting @fousa's standing in the gliding competition
#!/usr/bin/env ruby
require 'rubygems'
require 'open-uri'
require 'hpricot'
doc = open("http://www.lvzc.be/charronline/2010/klassement_benelux.php?list=standaard") { |f| Hpricot(f) }
def print_nicely(tr)
current_standing = tr.at("td:nth(0)").inner_html
name = tr.at("td:nth(1)").inner_html
points = tr.at("td:nth(9)").to_plain_text
puts "#{current_standing} #{name} (#{points})"
end
(doc).at("table:nth(2)").search("//tr").each do |tr|
print_nicely tr if (tr/"td").inner_html.include?"VANDEBEECK"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment