Last active
March 26, 2025 11:32
-
-
Save josircg/2a39af7f929c588627f917afa17459c4 to your computer and use it in GitHub Desktop.
Estatística de Servidores Mastodon Brasileiros
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
#!/usr/bin/env python | |
import requests | |
server_list = ('ursal.zone', 'bolha.us', 'colorid.es', | |
'mastodon.com.br', 'masto.donte.com.br', 'conversafiada.net', 'cwb.social', 'burnthis.town', | |
'piupiupiu.com.br', 'vira-lata.org', 'clube.social', 'bantu.social', 'cuscuz.in', | |
'komuna.digital', 'fim.social', 'social.br-linux.org', 'ayom.media', 'bertha.social', | |
'vox.mojo', 'bolha.one', 'oxente.club', 'nuvem.lgbt', 'mastodon.yurialbuquerque.dev', | |
'social.modscleo4.dev.br', 'botequim.social', 'mstdn.facb69.com.br', | |
'social.coletivos.org', | |
'aengus.ddnsgeek.com', 'mastodon.brigadadigital.tec.br', 'mastodon.girino.org', | |
'masto.lema.org', 'unipar.online', | |
) | |
tot_usuarios = 0 | |
tot_abertos = 0 | |
tot_ativos = 0 | |
resultset = [] | |
for server in server_list: | |
print(f'Buscando dados de {server}') | |
try: | |
response = requests.get(f"https://{server}/api/v2/instance", timeout=30) | |
if response.status_code == 200: | |
result = response.json() | |
resultset.append((server, | |
result['usage']['users']['active_month'], | |
result['registrations']['enabled'], | |
response.elapsed.total_seconds() | |
) | |
) | |
tot_usuarios += result['usage']['users']['active_month'] | |
tot_ativos += 1 | |
if result['registrations']['enabled']: | |
tot_abertos += 1 | |
else: | |
response = None | |
except requests.exceptions.ConnectionError: | |
response = None | |
if not response: | |
print(f'Servidor {server} fora do ar') | |
tot_pesquisados = len(server_list) | |
print(f'\nTotal de usuários: {tot_usuarios}') | |
print(f'\nTotal de Servidores pesquisados: {tot_pesquisados}') | |
print(f'\nTotal de Servidores ativos: {tot_ativos}') | |
print(f'\nTotal de Servidores abertos: {tot_abertos}') | |
resultset.sort(key=lambda a: a[1], reverse=True) | |
for registro in resultset: | |
print('%s. Usuários: %s. Aceita novos: %s (%s)' % registro) | |
arquivo = open('mastodon.csv', 'w') | |
arquivo.write('"Servidor","Usuário"\n') | |
for registro in resultset: | |
arquivo.write('%s,%s\n' % (registro[0], registro[1])) | |
arquivo.close() | |
print('mastodon.csv gerado com sucesso') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Total de usuários: 1364
Total de Servidores pesquisados: 44
Total de Servidores ativos: 29
Total de Servidores abertos: 15
ursal.zone. Usuários: 443. Aceita novos: True (0.889264)
bolha.us. Usuários: 251. Aceita novos: True (1.243407)
mastodon.com.br. Usuários: 98. Aceita novos: False (0.438346)
masto.donte.com.br. Usuários: 93. Aceita novos: False (0.772561)
colorid.es. Usuários: 76. Aceita novos: True (0.74779)
bolha.one. Usuários: 67. Aceita novos: False (0.446158)
ayom.media. Usuários: 60. Aceita novos: True (1.161355)
cwb.social. Usuários: 54. Aceita novos: True (3.24587)
bertha.social. Usuários: 38. Aceita novos: True (1.129847)
bantu.social. Usuários: 34. Aceita novos: False (0.927351)
burnthis.town. Usuários: 30. Aceita novos: True (0.647341)
social.coletivos.org. Usuários: 28. Aceita novos: False (1.091085)
conversafiada.net. Usuários: 26. Aceita novos: False (0.766404)
clube.social. Usuários: 11. Aceita novos: True (0.624003)
piupiupiu.com.br. Usuários: 8. Aceita novos: True (0.576594)
social.br-linux.org. Usuários: 8. Aceita novos: False (1.123519)
masto.empresasenegocios.com.br. Usuários: 8. Aceita novos: True (0.505274)
pynews.com.br. Usuários: 5. Aceita novos: False (0.819798)
panelinha.club. Usuários: 5. Aceita novos: False (0.781129)
mastodon.nudecri.unicamp.br. Usuários: 4. Aceita novos: False (0.101857)
masto.lema.org. Usuários: 3. Aceita novos: False (1.013717)
mato.social. Usuários: 3. Aceita novos: True (1.164534)