Skip to content

Instantly share code, notes, and snippets.

@rmoriz
Created March 23, 2014 19:04
Show Gist options
  • Save rmoriz/9205e131d9e35d0350f5 to your computer and use it in GitHub Desktop.
Save rmoriz/9205e131d9e35d0350f5 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'bundler/setup'
require 'nokogiri'
require 'open-uri'
require 'octokit'
url = 'https://www.hackerleague.org/hackathons/media-hack-day-2014/participations'
doc = Nokogiri::HTML(open(url))
usernames = []
doc.search('a.username').each do |link|
usernames << link.content
end
usernames.uniq!
data = {}
Octokit.configure do |c|
c.login = ''
c.password = ''
end
usernames.each do |username|
puts "processing #{username}"
begin
user = Octokit.user username
rescue
puts "Username not found"
next
end
data[username] = {}
data[username][:follower] = user.followers
data[username][:public_repos] = user.public_repos
data[username][:public_gists] = user.public_gists
sleep 5
end
data.each_pair do |user, kv|
puts "#{user}:"
puts "\t\tFollower: #{kv[:follower]}"
puts "\t\tRepos: #{kv[:public_repos]}"
puts "\t\tGists: #{kv[:public_gists]}"
puts
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment