tootbot/README.md

52 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

2017-05-29 21:03:17 +00:00
# TootBot
2018-02-09 14:46:32 +00:00
A small python 3.x script to replicate tweets on a mastodon account.
2017-05-29 21:03:17 +00:00
The script only need mastodon login/pass to post toots.
2022-11-05 17:03:11 +00:00
It gets the tweets using **twint**, then does some cleanup on the content:
2017-05-29 21:03:17 +00:00
- twitter tracking links (t.co) are dereferenced
2022-11-05 17:03:11 +00:00
- twitter hosted pictures or videos are retrieved with **yt-dlp** and uploaded to mastodon
2017-05-29 21:03:17 +00:00
2019-04-03 15:56:38 +00:00
It can also toot RSS/atom feeds (see cron-example.sh).
2017-05-29 21:03:17 +00:00
A sqlite database is used to keep track of tweets than have been tooted.
This script is in use for a few accounts:
- osm_fr -> https://fr.osm.social/@osm_fr
- sotmfr -> https://fr.osm.social/@sotmfr
2022-11-05 09:00:55 +00:00
- macbidouille -> https://amicale.net/@macbidouille
- nextinpact -> https://amicale.net/@nextinpact
2022-05-02 14:08:01 +00:00
- opendata -> https://amicale.net/@opendata
2017-05-29 21:03:17 +00:00
The script is simply called by a cron job and can run on any server (does not have to be on the mastodon instance server).
2018-10-19 13:52:02 +00:00
## Setup
2022-12-07 10:46:09 +00:00
```shell
2018-10-19 13:52:02 +00:00
# clone this repo
git clone https://github.com/cquest/tootbot.git
cd tootbot
# install required python modules
pip3 install -r requirements.txt
2018-10-19 13:56:53 +00:00
2022-11-23 20:01:48 +00:00
# install additional required software
2022-12-07 10:46:09 +00:00
sudo apt install jq
```
2022-11-23 20:01:48 +00:00
2018-10-19 13:56:53 +00:00
## Useage
2022-05-02 14:08:15 +00:00
`python3 tootbot.py <twitter_pseudo> <mastodon_account> <mastodon_password> <mastodon_domain> [max_items [tags_to_add]]`
2018-10-19 13:56:53 +00:00
Example:
`python3 tootbot.py geonym_fr geonym@mastodon.mydomain.org **password** mastodon.mydomain.org`
It's up to you to add this in your crontab :)
2019-04-03 15:56:38 +00:00
With a plain RSS/atom feed:
`python3 tootbot.py https://www.data.gouv.fr/fr/datasets/recent.atom cquest+opendata@amicale.net **password** amicale.net 2 "#dataset #opendata #datagouvfr"`