A tiny Python CLI program that reads your book highlights from a connected Kindle device, sorts through the mess and organizes all clippings into per-book markdown files and saves them into author folders at a given destination folder.
The script just needs the input file and an output folder:
$ python klip.py "~/Documents/kindle_highlights"
Sync complete.
Successfuly synced 22 new highlights to ~/Documents/kindle_highlights
Skipped 901 highlights already existing at ~/Documents/kindle_highlights
This will sort everything into this folder structure:
Clippings
└─── Author A
| | Book A1.md
| | Book A2.md
...
└─── Author Z
| Book Z1.md
With the markdown files being formatted as follows:
# What I Talk About When I Talk About Running (Haruki Murakami)
## Page 2 | Location 26-27 | 28 January 2018 22:26:17
No matter how mundane some action might appear, keep at it long enough and it becomes a contemplative, even meditative act.
...
The program automatically checks if highlights already exist at the destination and only appends new ones to their respective files.
First clone this repository using git:
$ git clone https://github.com/alex-schaaf/klip.git
Then install the dependencies using either the provided Pipfile
or manually.
$ pip install pipenv
$ pipenv install
$ pip install typer
Run the program to export the highlights as sorted markdown files:
$ python klip.py <destination>
To export the Kindle highlights as JSON run with flag --json
:
$ python klip.py <destination> --json