mirror of
https://framagit.org/veretcle/scootaloo.git
synced 2025-07-20 17:11:19 +02:00
85 lines
2.6 KiB
Markdown
85 lines
2.6 KiB
Markdown
A Twitter to Mastodon copy bot written in Rust
|
||
|
||
It:
|
||
* copies the content (text) of the original Tweet
|
||
* dereferences the links
|
||
* gets every attached media (photo, video or gif)
|
||
|
||
If any of the last steps failed, the Toot gets published with the exact same text as the Tweet.
|
||
|
||
RT are excluded, replies are included when considered part of a thread (reply to self), not the actual replies to other Twitter users.
|
||
|
||
# Usage
|
||
|
||
First up, create a configuration file (default path is `/usr/local/etc/scootaloo.toml`). It will look like this:
|
||
|
||
```toml
|
||
[scootaloo]
|
||
|
||
db_path="/var/lib/scootaloo/scootaloo.sqlite" ## file containing the SQLite Tweet corresponding Toot DB, must be writeable
|
||
cache_path="/tmp/scootaloo" ## a dir where the temporary files will be download, must be writeable
|
||
|
||
[twitter]
|
||
username="NintendojoFR" ## User Timeline to copy
|
||
|
||
## Consumer/Access key for Twitter (can be generated at https://developer.twitter.com/en/apps)
|
||
consumer_key="MYCONSUMERKEY"
|
||
consumer_secret="MYCONSUMERSECRET"
|
||
access_key="MYACCESSKEY"
|
||
access_secret="MYACCESSSECRET"
|
||
```
|
||
|
||
Then run the command with the `init` subcommand to initiate the DB:
|
||
```sh
|
||
scootaloo init
|
||
```
|
||
|
||
Then run the command with the `register` subcommand:
|
||
```sh
|
||
scootaloo register --host https://m.nintendojo.fr
|
||
```
|
||
|
||
This will give you the end of the TOML file. It will look like this:
|
||
|
||
```toml
|
||
[mastodon]
|
||
base = "https://m.nintendojo.fr"
|
||
client_id = "MYCLIENTID"
|
||
client_secret = "MYCLIENTSECRET"
|
||
redirect = "urn:ietf:wg:oauth:2.0:oob"
|
||
token = "MYTOKEN"
|
||
```
|
||
|
||
You can then run the application via `cron` for example. Here is the generic usage:
|
||
|
||
```sh
|
||
A Twitter to Mastodon bot
|
||
|
||
USAGE:
|
||
scootaloo [OPTIONS] [SUBCOMMAND]
|
||
|
||
FLAGS:
|
||
-h, --help Prints help information
|
||
-V, --version Prints version information
|
||
|
||
OPTIONS:
|
||
-c, --config <CONFIG_FILE> TOML config file for scootaloo (default /usr/local/etc/scootaloo.toml)
|
||
-l, --loglevel <LOGLEVEL> Log level. Valid values are: Off, Warn, Error, Info, Debug
|
||
|
||
SUBCOMMANDS:
|
||
help Prints this message or the help of the given subcommand(s)
|
||
init Command to init Scootaloo DB
|
||
register Command to register to a Mastodon Instance
|
||
```
|
||
|
||
# Quirks
|
||
|
||
Scootaloo does not respect the spam limits imposed by Mastodon: it will make a 429 error if too much Tweets are converted to Toots in a short amount of time (and it will not recover from it). By default, it gets the last 200 tweets from the user timeline (which is a lot!). It is recommended to put a Tweet number into the DB file before copying an old account.
|
||
|
||
You can can insert it like this:
|
||
```sh
|
||
sqlite3 /var/lib/scootaloo/scootaloo.sqlite
|
||
INSERT INTO tweet_to_toot VALUES (1383782580412030982, "");
|
||
.quit
|
||
```
|