A script to extract and parse Kindle highlights and notes from My Clippings.txt
.
When I read, I highlight important passages and take short notes on some of them. When I'm done with the book, I want to move these highlights into my Obisidian vault to expand on them. In addition, I also highlight single words and short sentences that I want to learn to expand my vocabulary. To memorize them, I then use the space-repetition software Anki.
This script facilitates my workflow by formatting highlights and notes into one markdown file for each book and by adding all new words into a single file that I keep on my computer so that I can later turn them into Anki flashcards.
After having connected the Kindle device to your computer via USB cable, run the Bash script kindle_highlight.sh
.
This script will
- Mount the Kindle device, assuming it's located at
sda/sda1
- Copy
My Clippings.txt
from it to the directory where the script is located - Run the Python parser
- Copy the book notes to the Obsidian vault and append the new words to the designated file
- Copy the updated
My Clippings.txt
file back to the Kindle - Unmount the Kindle device
The Python parser will
- Extract clippings from the clipping file and sort them by book
- Ask the user which books haven't been completed yet and store their clippings in the new clippings file to put back in the Kindle
- Connect each note to the corresponding highlight
- Separate short highlights without a note to add them to the list of new words to learn
- For each book, put all other highlights and notes (book notes) into a markdown file which will be copied into the Obsidian vault