This is a Twitter bot written in python (version 3) that reads the RSS feeds of the CERN Document Server (CDS) and creates tweets/toots of new publications.
It currently works pretty well for the ATLAS and CMS feeds listed in feeds.ini
, could probably easily be extended to the LHCb and ALICE ones listed in the file already.
Follow the bots on twitter @CMSpapers, @ATLASpapers/@ATLAS_results, and @LHCb_results. Or follow on Mastodon: @cmspapers@botsin.space.
To get it to work as a bot, an auth.ini
file containing information in the following format:
[CMS]
BOT_HANDLE = @CMS_results
CONSUMER_KEY = xxxxxxxxxxxxxxxxxxxxxxxxx
CONSUMER_SECRET = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ACCESS_TOKEN = xxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ACCESS_TOKEN_SECRET = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
For more details on authentication, refer to the Twitter Developer Platform.
For using the tool with a Mastodon bot, auth.ini
should contain:
[CMS]
MASTODON_BOT_HANDLE = @CMSpapers@botsin.space
MASTODON_ACCESS_TOKEN = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
You can obtain the access token by creating a new application on your Mastodon account's application settings (here provided for botsin.space).
For information on running the bot, do
python cds_paper_bot.py --help
Note: if this doesn't work on MacOS, make sure to brew install freetype imagemagick
and export MAGICK_HOME=/opt/homebrew/opt/imagemagick
.
If you would like to run the bot in an isolated environment, e.g. on a Raspberry Pi, you can try to use the Dockerfile. Build the container using:
docker build -t cds_paper_bot .
Then run it from the repository directory:
docker run --rm -ti -v "$(pwd)":/home/app -w /home/app cds_paper_bot python cds_paper_bot.py
Using the CERN GitLab installation and its CI/CD capabilities, you can run the bot such that it regularly checks for new analyses. Follow the instructions here.