Created
December 5, 2014 02:02
-
-
Save rubys/81f7246ff5e96b504643 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogumbo' | |
require 'date' | |
require 'json' | |
start = Date.today - 105 | |
results = {} | |
index = 'http://www.w3.org/community/groups/' | |
groups = Nokogiri::HTML5.get(index) | |
groups = groups.search('a.h3').map {|a| a['href'].sub(/^#/, '')} | |
groups.each do |group| | |
list = "http://lists.w3.org/Archives/Public/public-#{group}" | |
doc = Nokogiri::HTML5.get(list) | |
count = 0 | |
doc.search('tbody tr').each do |tr| | |
next if tr.at('td').text == 'n/a' | |
date=Date.parse(tr.at('td').text) | |
count += tr.search('td').last.text.to_i if date > start | |
end | |
results[group] = count | |
end | |
puts JSON.pretty_generate(results) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment