How do you get book highlights out of MoonReader without Readwise?
It turns out you can use MoonReader's real-time Readwise sync feature with any url, so you can just point it to an endpoint you control. See @ynhhoJ's helpful setup guide.
If you want to get old highlights out of a MoonReader backups this is how I'm doing so.
Get the backup file ending in .mrstd or .mrpro and unzip it. The unzipped com.flyersoft.moonreader folder contains a bunch of numbered .tag files (1.tag, 2.tag, ...) whose human-readable file names are in the corresponding line of _names.list. The file with the main sqlite3 database is mrbooks.db. So, we can open with:
sqlite3 $(awk '/mrbooks.db$/ {print FNR".tag"}' _names.list)
You'll notice the db has several tables and that your highlights are in notes. import.py has an example script.
The rest of this repo is a simple "vibe coded" flask site for managing my own highlights. Live (with limited functionality if not logged in) here.
- Create and
.envfile with variables:
PASSWORD=
SESSION_SECRET=
MOON_READER_TOKEN=
N_REVIEW_PASSAGES=
N_FAVORITES_IN_REVIEW=
- Run
uv run --env-file .env main.py - Optionally, setup cron job to run
review.py. For example:
0 13 * * * cd ~/moonwise && uv run review.py && sh notify.sh
If you ever drop the highlights_fts table, re-populate it with:
INSERT INTO highlights_fts(rowid, highlight_text, note)
SELECT id, highlight_text, note FROM highlights;