26

I've hovered over the Stack Exchange icon in the top-left corner of the screen from Stack Overflow and this is what I saw:

I've also hovered over the Stack Exchange icon in the top-left corner of the screen from http://www.stackexchange.com and this is what I saw:

I manually counted every site from here and I found out that there are 137 sites.

  • How many sites are there in total? 142, 140 or 137 ?
  • Why do I find different number of sites in the two tooltips?
10
  • 15
    Shouldn't this question be migrated to meta.stackexchange.com? Commented Mar 31, 2015 at 8:24
  • 3
    Apparently, not necessarily meta.stackoverflow.com/a/255291/248065 Commented Mar 31, 2015 at 8:26
  • 8
    This is not the first time. Or the second. Or the third. In some places private betas are being included in the count. Commented Mar 31, 2015 at 8:35
  • @MartijnPieters , I didn't know that! BTW, Your second link redirects me to the first one.
    – Spikatrix
    Commented Mar 31, 2015 at 8:46
  • @CoolGuy: it's a dupe, so it redirects for anon visits. It is also linked in the sidebar from the first, with ?lq=1 appended, so it doesn't redirect: How many Stack Exchange sites are there really? Commented Mar 31, 2015 at 8:47
  • @MartijnPieters , So, this means that if I had a MSE account, I can see the duplicate question?
    – Spikatrix
    Commented Mar 31, 2015 at 9:39
  • @CoolGuy: it wouldn't auto-redirect; although there may be a minimum rep requirement. Don't you see the How many Stack Exchange sites title in the linked section of the first post? Commented Mar 31, 2015 at 13:01
  • 3
    @CoolGuy: ah, for anon users it still redirects even when you click on that.. Commented Mar 31, 2015 at 13:02
  • 5
    Better to just say "A list of all stackexchange sites..." forget about the number because then you deal with us anal programmers who will say otherwise.
    – JonH
    Commented Apr 1, 2015 at 14:54
  • This question is the definition of too localised. Commented May 11, 2015 at 9:34

1 Answer 1

7

The reliable way to get those numbers is calling the /sites endpoint on the Stack API and compensate for the missing Area 51 from that list. That is the total number of sites reported in the site switcher of Stack Exchange.com.

If you run the code snippet you'll get the actual count for each category. When you subtract the number of closed_beta from the total, you'll get the number of sites that is available in the Site switcher of the Q/A sites. Notice that the number equals the site databases in SEDE (but wait for the next Sunday if a site went into beta)

$.get(['https://api.stackexchange.com',
       '2.2',
       'sites'].join('/') + '?pagesize=500&filter=!6Oe787x*vzH7Z', 
      function(data) {
        var states=[], i, j, val, tot = 0; 
        for(i=0; i< data.items.length; i++){
          val = states[data.items[i].site_state];
          if (val == undefined) {
            val =1;
          } else {
            val++;
          }
          states[data.items[i].site_state] = val;
        }
        for(j in states) {
          if (j !== 'linked_meta') {
            tot = tot + states[j];
            $('#site_stat').append(
              $('<tr>').append(
                 $('<td>').text(j), $('<td>').text(states[j])
              ) 
            );
          }
          console.log(j);
          console.log(states[j]);
        }
        $('#site_stat').append(
              $('<tr>').append(
                 $('<td>').text('Area 51'), $('<td>').text('1')
              ) 
            );
         $('#site_stat').append(
              $('<tr>').append(
                 $('<td>').text('total'), $('<td>').text(tot+1)
              ) 
            );
      });
td:nth-child(2)
{
  text-align: right;  
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table id="site_stat">
  
</table>

You must log in to answer this question.

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