Manage keyword filters on Mastodon from command-line (and a simple GUI).
macOS
$ brew install [email protected]
$ brew install python-tk
FreeBSD
$ pkg install python39
$ pkg install py39-tkinter
Instance URL will be of the form:
Create an access-token for your account by visiting:
- https://INSTANCE-DOMAIN/settings/applications
- Click on "New Application"
- Provide a name (example: "mastodon-filter")
- Check
read:filters
- Check
write:filters
- Copy value of "Your access token"
If running CLI, see Configure section
If running GUI, use Instance Menu to configure instance URL and Access Token.
$ python3 -m pip install pipx
$ pipx install git+https://github.com/hiway/mastodon-filter.git
$ mastodon-filter --help
$ git clone https://github.com/hiway/mastodon-filter.git
$ cd mastodon-filter
$ poetry install
$ poetry shell
$ mastodon-filter --help
$ mastodon-filter
$ mastodon-filter --help
$ mastodon-filter config
Instance URL [https://example.social]: https://mastodon.sharma.io
Access token []: PASTE-YOUR-ACCESS-TOKEN-HERE
View all configured filters.
$ mastodon-filter list
Output each keyword in a filter on a separate line.
Pipe output to grep
to filter words.
$ mastodon-filter show TITLE
Backup your existing filter to a file by redirecting output. Share the file with friends or strangers if you like. They can then use it to create their own filters.
$ mastodon-filter show TITLE > WORDLIST-FILE
Have a list of words you want to filter?
Someone shared their wordlist?
Import it into your account and create a new filter.
Filter titles must be unique.
Use the list
command to see your existing filters.
$ mastodon-filter create TITLE WORDLIST-FILE
Quickly get started with a new filter list by typing out the words or phrases, each on a new line. Finally press Ctrl+D to exit text-entry mode and save the filter.
$ mastodon-filter create TITLE -
Once you have a few filters set up, edit the text file locally and update the server to add new words or remove deleted words.
$ mastodon-filter sync TITLE WORDLIST-FILE
Delete a filter and discard all words in it.
Use show
to backup the words to a text file before deleting.
$ mastodon-filter delete TITLE
List names of available templates.
$ mastodon-filter template list
Show the words in a template.
$ mastodon-filter template show NAME
Create a new filter from a template.
$ mastodon-filter template use NAME TITLE