Created
November 21, 2010 02:35
-
-
Save cesarkawakami/708381 to your computer and use it in GitHub Desktop.
Google Groups statistics gatherer
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
var v = []; | |
var text = '<table>'; | |
var months = [ | |
{name: 'Jan', index: '01'}, | |
{name: 'Feb', index: '02'}, | |
{name: 'Mar', index: '03'}, | |
{name: 'Apr', index: '04'}, | |
{name: 'May', index: '05'}, | |
{name: 'Jun', index: '06'}, | |
{name: 'Jul', index: '07'}, | |
{name: 'Aug', index: '08'}, | |
{name: 'Sep', index: '09'}, | |
{name: 'Oct', index: '10'}, | |
{name: 'Nov', index: '11'}, | |
{name: 'Dec', index: '12'}, | |
]; | |
months.forEach(function(month) { | |
for (var start = 0; ; start += 250) { | |
xhr = new XMLHttpRequest(); | |
xhr.open("GET", "http://groups.google.com/group/itacomp11/index/browse_frm/month/2010-" + month.index + "?scoring=d&start=" + start + "", false); | |
xhr.send(); | |
var matches = xhr.responseText.match(new RegExp(month.name + " [0-9][0-9]?", "g")); | |
if (matches == null || matches.length == 0) | |
break; | |
v = v.concat(matches); | |
}; | |
}); | |
var s = []; | |
v.forEach(function(val) { | |
if (s[val] == undefined) | |
s[val] = 1; | |
else | |
s[val]++; | |
}); | |
for (var key in s) { | |
text += '<tr><td>' + key + '</td><td>' + s[key] + '</td></tr>'; | |
} | |
text += '</table>'; | |
document.body.innerHTML = text; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment