33

There are a few members of Stack Overflow especially who have a ridiculous number of helpful flags.

At the moment, there does not appear to be any way to display the top users with the most helpful flags. Even though this information is already available publicly, there does not seem to be any way to query all users and make a custom leaderboard, using SEDE, or other programming tools.

A quick search on Meta did not yield anything related to this topic.

This is not limited to Stack Overflow (although that site will no doubt prove to be the most voluminous).

Is there any way to see a short list of top flaggers on the Stack Exchange sites?


See this? This is what I'm talking about! Totally awesome.

enter image description here

1

2 Answers 2

24

One way to find out is to look at the profile of every user with the Marshal badge, and compare. On Stack Overflow, the following users have 20K+ helpful flags as of now (2019-08-27):

  1. Andy, 130603 helpful flags
  2. Floern, 125891 helpful flags
  3. Pang, 99641 helpful flags
  4. Jamal, 47735 helpful flags
  5. gnat, 41872 helpful flags
  6. Wai Ha Lee, 37314 helpful flags
  7. Tunaki, 37170 helpful flags
  8. ayaio, 36201 helpful flags
  9. CRABOLO, 34947 helpful flags
  10. Shree, 34704 helpful flags
  11. Bo Persson, 22717 helpful flags
  12. Taryn, 22118 helpful flags
  13. Mitch Wheat, 20945 helpful flags
  14. Zoe, 20780 helpful flags

A complete list can be found here on GitHub; note that some users have less than 500 helpful flags because of a bug in the system, cf. I got the Marshal badge with less than 500 helpful flags.

Notes:

  • Andy is now a moderator and spends more time handling flags than casting them. Before that, he ran a bot under his account to automatically flag comments.
  • Community is a bot raising flags based on heuristics.
  • CRABOLO and Tunaki are no longer active.
  • Taryn was a moderator and later community manager and DBA at Stack Overflow.
  • Not all helpful flags are equally helpful.
2
  • 4
    Moderators still have their helpful flag counts incremented, it's just rare for moderators to actually cast flags (usually only ever cast spam/abusive flags to insta kill a post) so the number rarely goes up anymore. Moderators are simply ineligible to receive the helpful flags badges (like Marshall) while they have a diamond.
    – animuson StaffMod
    Apr 5, 2018 at 1:50
  • 3
    I have updated the ranking. gist.github.com/kamil-tekiela/e5d3b2b8f3b48f3b0a426feb85b1369f
    – Dharman
    Jun 29, 2021 at 13:50
11
+50

There's no such list, but will a little bit of JavaScript it's possible to generate this list yourself. You'll need to visit the Marshal badge page (on the target site), open the browser console and execute the code below. Sometimes, a little patience is required (generating this list with 2910 top flaggers on Stack Overflow took about 15 minutes), but the console will give some indication about the progress and finally spit out some Markdown you can use to update the top list.

// Execute this snippet in the browser console on the Marshal badge page,
// e.g. https://meta.stackexchange.com/help/badges/160/marshal
// It'll probably work on Deputy as well, but then it takes longer...

// { relative URL to profile page -> display name }
var users = {};
// { relative URL to profile page -> flag count }
var flagCounts = {};
// [ relative URL to profile page ]
var urls = [];

// Determine current & last page number
let pager = $(".s-pagination--item.is-selected");
let currentPage = pager.length == 0 ? 1 : parseInt(pager[0].innerText);
var lastPage = 1;
let pageLinks = $("div.pager").find("a");
let baseLink = window.location.href.split('?')[0] + "?page=";
if (pageLinks.length != 0) {
  // The last link is 'next', unless we're on the last page itself.
  if ("next" == pageLinks[pageLinks.length - 1].getAttribute("rel")) {
    // We need the one before to determine the # of pages.
    lastPage = parseInt(pageLinks[pageLinks.length - 2].getAttribute("href").split("?page=")[1]);      
  } else {
    lastPage = currentPage;
  }
}

// Process a single user
function processUser(index) {
  if (index == urls.length) {
    // All profiles have been read
      
    // Sort by # of helpful flags
    urls.sort(function (a, b) {
      return flagCounts[b] - flagCounts[a];
    });
      
    // Output to console
    var output = "";
    for (var rank = 0; rank < urls.length; rank++) {
      let topFlagger = urls[rank];
      output += (rank + 1) + ". [" + users[topFlagger] + "](" + topFlagger + "), " + flagCounts[topFlagger] + " helpful flags\n";
    }
    console.log(output);
    return;
  }
  
  if (index > 0 && index % 10 == 0) {
    console.log(index + " top flagger details fetched");
  }

  // Fetch profile page
  let url = urls[index];
  $.get(url + "?tab=topactivity", function (data) {
    // NOTE: second cell (the last cell is the # of unhelpful flags, if you're a moderator on that site)
    for (let header of $(data).find("h1")) {
      if (header.innerText == "Impact") {
        for (let label of $(header).parent().find("div")) {
          if (label.innerText == "helpful flags") {
            flagCounts[url] = parseInt($(label).parent().children()[0].innerText.replace(",", ""));
            processUser(++index);
            break;
          }
        }
        break;
      }
    }
  }).error(function(xhr, status, error) {
    console.error(url + ': ' + status + ' - ' + error);
    processUser(++index);
  });
}

// Process a single page of users with the badge
function processPage(page, lastPage) {
  if (page > lastPage) {
    // Fetch profile pages
    let numberOfUsers = Object.keys(users).length;
    if (numberOfUsers == 0)
      return;
    console.log("Found " + numberOfUsers + " top flaggers");
    urls = Object.keys(users);
    processUser(0);
    return;
  }
  console.log("Page " + page);
  let selector = "div.user-details a";
  if (page == currentPage) {
    // Process current page
    $(selector).each(function() {
      users[$(this).attr("href")] = $(this).text();
    });
    processPage(page + 1, lastPage);
  } else {
    // Fetch page
    $.get(baseLink + page, function (data) {
      // Process fetched page
      $(data).find(selector).each(function() {
        users[$(this).attr("href")] = $(this).text();
      });
      processPage(page + 1, lastPage);
    });
  }
}
 
// Start processing pages 
processPage(1, lastPage);

Some notes:

  • Profile links are relative, so if you want to update the list above, you'll need to find /users/ and replace it with https://stackoverflow.com/users/.
  • The script works for Deputy as well, but this will of course take more time. You might even get rate-limited because the script has to fetch each profile page separately.
  • Some users have less helpful flags than the badge requirement; this is due to an old bug in the system, cf. I got the Marshal badge with less than 500 helpful flags.
6
  • I tried your script on SO's Marshal badge page and after reading "270 top flagger details fetched" I repeatedly got the error "Too many requests". Is there a way to overcome the rate limit or do you need to update the list in the other answer by yourself? wink wink
    – honk
    Jun 29, 2021 at 12:43
  • 1
    @honk too bad ... You could try adding a delay of, say, 1 second, at the beginning of the processUser function. It does mean the script will take an hour or so longer to complete.
    – Glorfindel Mod
    Jun 29, 2021 at 13:33
  • How didn't you suffer from the rate limit? I don't think it was introduced recently, wasn't it? Anyway, if I updated the other answer, it would be out of sync with your list on GitHub that you linked, so I leave that to you ;)
    – honk
    Jun 29, 2021 at 13:44
  • @honk Dharman already did it (sort of), see the other answer
    – Glorfindel Mod
    Jun 29, 2021 at 14:43
  • Tried running this, it returns NaN for the number of flags. I imagine it's because of the profile layout changes. Apr 22 at 18:33
  • @ThomasMarkov yes, thanks for the notification. I've updated the script now.
    – Glorfindel Mod
    Apr 23 at 7:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .