mirror of
https://github.com/hughrun/ephemetoot
synced 2025-01-10 13:02:36 +01:00
1.7 KiB
1.7 KiB
A script for deleting old toots. Based partially on tweet-deleting script by @flesueur (https://gist.github.com/flesueur/bcb2d9185b64c5191915d860ad19f23f)
Usage
This script requires Python3, the mastodon.py
package and an API access token.
- Install Python3 if you don't already have it
- Install the mastodon package:
pip3 install mastodon.py
- Copy example.config.py to a new file called config.py (e.g.
cp example.config.py config.py
) - Log in to you Mastodon account
- Click the settings cog
- Click on Development
- Click 'NEW APPLICATION'
- Enter an application name, and give the app 'read' and 'write' Scopes
- Click 'SUBMIT'
- Click on the name of the new app
- Copy the 'access token' string
- Replace
YOUR_ACCESS_TOKEN_HERE
in config.py with the access token string - Set the base_url to match your mastodon server
- Set the
days_to_keep
to the number of days you want to keep toots before deleting them - If you do not wish to keep all pinned toots regardless of age, change
saved_pinned
toFalse
- If there are any other toots you want to keep, put the ID numbers (without quotes) in the
toots_to_save
list, separated by commas. For example:toots_to_save = [100029521330725397, 100013562864734780, 100044187305250752]
- Run the script with
python3 ephemetoot.py
. Depending on how many toots you have and how long you want to keep them, it may take a minute or two before you see any results. - To run every day use crontab:
crontab -e
@daily python3 ~/ephemetoot/ephemetoot.py
Bugs
Please log an issue with as much detail as possible (but don't include your access token!).
License
GPL 3.0+