JavaSript / Soapi.JS
using Soapi.JS
Soapi.RouteFactory("api.stackapps.com", apiKey) // get all users
.Questions({ pagesize: 100 }).getPagedResponse(function(data) {
var values = {}, keys = [];
// add up the score for each user
for (var i = 0; i < data.items.length; i++) {
var q = data.items[i];
var u = q.owner;
if (u) {
if (!values[u.user_id]) {
keys.push(u.user_id);
values[u.user_id] = {
display_name: u.display_name,
score: 0
};
}
values[u.user_id].score += q.score;
}
}
// sort and dump
var output = "";
for (var i = 0; i < keys.sort(function(a, b) {
return values[b].score - values[a].score;
}).length; i++) {
output += values[keys[i]].score + " " + values[keys[i]].display_name + "\r\n";
}
document.getElementById("output").innerHTML = output;
});
Output:
266 George Edison
265 code poet
187 Kevin Montrose
88 systempuntoout
77 Soviut
71 S.Mark
70 Felix
70 Farseeker
65 lfoust
50 Adam Wright
42 Dave Swersky
38 Steffen Opel
38 carson
38 Edan Maor
36 Franci Penov
32 Lucas Jones
31 Bill the Lizard
29 Dave DeLong
28 Thomas McDonald
28 Mark Rushakoff
25 Jedi Master Spooky
25 Shay Erlichmen
24 johnwards
24 swanson
23 TheHurt
22 codeka
22 Catchwa
21 Dennis Williamson
20 radius
20 SztupY
17 jjnguy
17 Matt S.
17 ColinD
17 Kyle Cronin
16 Yacoby
16 Jeff Atwood
16 Ricky
16 Jason
15 Nick Presta
15 Adam
15 eWolf
14 Joel Potter
13 Ryan Brunner
12 RichH
11 Igor Zevaka
11 InfinitiesLoop
11 Koning Baard
11 adrianbanks
10 nabeelmukhtar
10 Martin Plante
9 phsr
8 Nathan Reed
8 Robert Munteanu
8 Peter Mourfield
8 Jan Fabry
7 conmulligan
7 Josh Kelley
6 balpha
6 blork
6 Jonathan
6 Michael B.
6 Kevin
6 Peter Mortensen
6 Martijn Laarman
5 Soldier.moth
5 TheKaptain
5 fukas78
5 chenyuejie
5 mlaw
5 James A. Rosen
5 Tim Post
5 Riduidel
5 Joe
5 mikej
5 Chacha102
4 AidenMontgomery
4 Nathan Voxland
4 bpedro
4 Robert Cartaino
4 jmoy
4 Nippysaurus
4 iconiK
4 denny
4 John Bristowe
4 Mark Hurd
4 Matthew Pelser
3 James Johnson
3 tonklon
3 Matt Culbreth
3 magcius
3 Bialecki
3 svick
3 Casebash
3 Maxim Zaslavsky
3 daltojr
3 Fatal510
3 Dan Atkinson
3 Lucas McCoy
2 Alexandre Rafalovitch
2 tsudot
2 Roy Tang
2 Shane
2 Frank Krueger
2 David
2 pierocampanelli
2 Charles Stewart
2 Robert Love
2 Greg Bray
2 voyager
2 coobird
1 crucible
1 Peter Ajtai
1 Nicolas Raoul
1 DC01
1 Evan
1 Can Berk Güder
1 Shimmy
1 Michal
1 Fernando
1 JL01
1 user1711
1 Artefacto
1 Mattias Konradsson
0 chanchal1987
0 zengr
0 RichOrr
0 Bidhan Baruah
0 arinte
0 Ngu Soon Hui
0 hvgotcodes
0 Dinis Cruz
0 Vitaly Polonetsky
0 Vicky
0 theplic
0 Simon Brown
0 C.W.Holeman II
0 pufferfish
0 chalup
0 Cristian Castiblanco
0 stacker
0 Heavy Bytes
0 Jim McKeeth
0 Wei Hu
0 Chris S
0 ADB
0 Matt Huggins
0 Alienfluid
0 Portman
0 scunliffe
-1 peter.newhook
-2 ripper234
Requests generated (elapsed time 3 seconds)
Result Protocol Host URL Body Caching Content-Type Process Comments Custom
1 200 HTTP api.stackapps.com /1.0/questions?key=foo-bar-fu&pagesize=100&page=1&jsonp=Soapi._internal._callback0 14,486 private application/json; charset=utf-8 iexplore:3360
2 200 HTTP api.stackapps.com /1.0/questions?key=foo-bar-fu&pagesize=100&page=2&jsonp=Soapi._internal._callback1 14,704 private application/json; charset=utf-8 iexplore:3360
3 200 HTTP api.stackapps.com /1.0/questions?key=foo-bar-fu&pagesize=100&page=3&jsonp=Soapi._internal._callback2 15,407 private application/json; charset=utf-8 iexplore:3360
4 200 HTTP api.stackapps.com /1.0/questions?key=foo-bar-fu&pagesize=100&page=4&jsonp=Soapi._internal._callback3 14,012 private application/json; charset=utf-8 iexplore:3360
5 200 HTTP api.stackapps.com /1.0/questions?key=foo-bar-fu&pagesize=100&page=5&jsonp=Soapi._internal._callback4 14,457 private application/json; charset=utf-8 iexplore:3360
6 200 HTTP api.stackapps.com /1.0/questions?key=foo-bar-fu&pagesize=100&page=6&jsonp=Soapi._internal._callback5 4,234 private application/json; charset=utf-8 iexplore:3360
7 200 HTTP api.stackapps.com /1.0/questions?key=foo-bar-fu&pagesize=100&page=7&jsonp=Soapi._internal._callback6 204 private application/json; charset=utf-8 iexplore:3360
score. The logical difference is that votes on CW questions do not count towards score. The functional difference is nil as both fields are present on the question object. – Sky Sanders Aug 16 '10 at 21:51