README.md |
Fediverse Stats
This code gets all peers from running Mastodon or Pleroma host server and then all peers from host server's peers. Goal is to collect maximum number of alive fediverse's servers and then query their API to obtain their registered users (if their API provide such information). At the end it post the results to host server bot account.
Dependencies
- Python 3
- Postgresql server
- Mastodon or Pleroma running server.
Usage:
Within Python Virtual Environment:
-
Run
python db-setup.py
to setup and create new Postgresql database and needed tables in it. -
Run
python setup.py
to get your bot's access token of your Mastodon or Pleroma server existing account. It will be saved to 'secrets/secrets.txt' for further use. -
Run
python getworld.py
to get all peers from your host and the whole world of fediverse's servers (or almost the whole world). -
Run
python fediverse.py
to query world alive servers API. It gets data from server's API according this table:
Software | API | API | API | API peers | API users (nodeinfo/2.0.json) | API users api/v1/instance |
---|---|---|---|---|---|---|
Diaspora | nodeinfo/2.0.json | |||||
Friendica | nodeinfo/2.0.json | api/v1/instance | nodeinfo/2.0 | api/v1/instance/peers | ||
GNU Social | ||||||
Hubzilla | ||||||
Mastodon | nodeinfo/2.0.json | api/v1/instance | api/v1/instance/peers | ['usage']['users']['total'] (since v3.0.0) | ['stats']['user_count'] | |
Peertube | nodeinfo/2.0.json | |||||
Pleroma | nodeinfo/2.0.json | api/v1/instance | api/v1/instance/peers | ['usage']['users']['total'] |
- Use your favourite scheduling method to set ratio.py to run regularly.
Note: install all needed packages with 'pip install package' or use 'pip install -r requirements.txt' to install them.