Sync Bookmarks from Mastodon to Shaari

posted on 2023-05-01

mastodon-shaarli-sync

This piece of code lets you sync your Mastodon bookmarks with your Shaarli bookmarks. The script looks for urls in your bookmarked toots and saves them as a Shaarli bookmark. Removing the bookmark from Shaarli (or removing the sync-tag) will remove the bookmark form the original toot as well, so your Mastodon bookmarks always stay in sync with Shaarli.

Installation

git clone https://github.com/Kudusch/mastodon-shaarli-sync
cd mastodon-shaarli-sync/
python3 -m virtualenv venv
source venv/bin/activate
pip install -r requirements.txt

You'll have to edit the example_config.ini, add your Mastodon and Shaarli credentials and rename it to config.ini.

The script does not detect changes in your Mastodon bookmarks, so you'll have to run the script in regular intervals. You can achieve that with cron like so:

crontab -e

*/5 * * * * [installation_path]/mastodon-shaarli-sync/venv/bin/python3 [installation_path]/mastodon-shaarli-sync/main.py >> [installation_path]/mastodon-shaarli-sync/log.txt

Features

  • Sync Mastodon bookmarks with Shaarli bookmarks
  • Look for urls in bookmarked toots and save them individually to Shaarli
  • Bookmarks stay in sync: Removing a bookmark from a toot removes the bookmark from Shaarli and vice versa
  • Want to keep the Shaarli bookmark but not clutter your Mastodon bookmarks? Just remove the mastodon-bookmark tag from the Shaarli bookmark. This will remove the Mastodon bookmark but not delete the Shaarli link
  • Saves the link to the toot in the Shaarli bookmark

Example Bookmark