This code publish content from a RSS feed.
- Python 3
- Mastodon account
In actions.yaml
url: feed urlannouncement: first line in Mastodon publicationhashtags: last line in Mastodon publicationdays: number of valid days in feed file.repetitions: number of elements in the repetitions control file.max: maximum number of publicationsreverse: descending sorting in feed file.
In config.yaml
hostname: instance urlaccess_type: credentials, acces token o github action (SO environment variables)access_token: client-id, secret and token in "access token" acces_type.disable_post: test option for no publish toots.
Server o desktop:
-
Optionally, create a new user for running the bot:
adduser --disabled-login user_name -
Clone the repository
git clone https://github.com/kergozh/mastofeed.git -
Crate a virtual environment
python3 -m venv .venvand activate itsource .venv/bin/activate -
Run
pip install -r requirements.txtto install needed libraries. -
Modify options in the
actions.yamlandconfig.yamlfiles. -
It's possible to fill in the config yaml the cliend id, cliend secret and access token of an application created in the Mastodon web (with de "development" opction). Also, it's possilbe to indicate credentials access and run
python3 quote.pymanually once to setup and get its access token to Mastodon instance. -
Use your favourite scheduling method to set
feed.shto run. For example, add0 6 * * * /home/user_name/mastofeed/feed.sh 2>&1 | /usr/bin/logger -t MASTOFEEDincrontab -e. The system and error log will be in/var/log/syslog. Don't forgot the execution privilegieschmod +x feed.sh. Don't forgot update the user_name infeed.sh
Github Action:
-
Fork the repo.
-
Add client-id, secret and token in settings > security > secrets and variables > actions > repository secrets as:
MASTO_CLIENT_ID,MASTO_SECRETandMASTO_TOKEN. -
Change
access_typein config.yaml aGA -
Check
disable_postparameter in config.yaml -
Uncomment the cron options in .github/workflows/mastofeed.yml