Skip to content

Instantly share code, notes, and snippets.

@svs
Last active December 16, 2015 22:49
Show Gist options
  • Save svs/5509445 to your computer and use it in GitHub Desktop.
Save svs/5509445 to your computer and use it in GitHub Desktop.
require 'mechanize'
a = Mechanize.new
results = {}
last_id = 647
(1..last_id).map do |id|
begin
page = a.get("http://cfp.euruko2013.org/users/#{id}/selections")
d = page.
search('a').
select{|x| x.attributes["href"].value.match(/proposals/)}.
map{|l| l.text.strip.split(":")[0]}[1..-2] rescue []
name = page.links.select{|l| l.attributes["href"].match(/users/)}.map(&:text)[0].strip rescue "oops"
d.each{|name| results[name] ? results[name] += 1: results[name] = 1}
rescue
end
end
results.sort_by{|k,v| -v}.each{|k,v| puts "#{k} => #{v}"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment