jkingsman / Nobody.live

View twitch streamers with zero viewers at nobody.live
https://nobody.live
MIT License
101 stars 8 forks source link

nobody.live

Architecture

A worker script (scanner.py) loops through the Twitch API's list of streams and spins until it inserts all streamers it finds matching the search criteria (default zero viewers), then it starts again. These stale streams are pruned after a fresh reload occurs on the assumption that someone will view them and then they won't have zero viewers any more so should not be served for too long; we'll pick them back up on the next load if they're still viewerless.

Environment variables needed for both scanner and app:

Environment variables to be set for the scanner only:

Meanwhile, the Sanic app in app.py serves the index and the endpoint to get a random streamer.

Note that the database schema makes use of slightly unusual extensions, namely pg_trgm (trigram indices) and tsm_system_rows. You may need to install your operating system's flavor of postgresql-contrib in order for them to work correctly. Also, you may need to grant your service user superuser permissions OR remove the extension creation calls from the db_utils.py migration block.

Getting Up and Running

This is obviously not production ready; you'll need to make sure all services are running as daemons (an example supervisord config is included in etc) and that your Sanic app is running safely (e.g. behind gunicorn/nginx/pick your poison).

Dependencies

Update direct dependencies in requirements.in; use pip-compile to compile them down to requirements.txt if you update them.

Components

Cite this work

If you reference Nobody.live in a paper, check out the CITATION.cff file for the correct citation.

@misc{Nobody.live,
url={https://nobody.live/},
journal={Nobody.live},
publisher={Jack Kingsman},
author={Kingsman, Jack},
year={2020},
month={Nov},
doi="10.13140/RG.2.2.15356.55682",
note={{\url{https://github.com/jkingsman/Nobody.live}}}
}