Extract Kindle highlights using JS in the browser
By Kristoffer Midttømme
- 2 minutes read - 277 wordsOftentimes when I read non-fiction books on my Kindle, I make a lot of highlights. I don’t actually remember how I used to extract them, but I know I did. It was a manual process, and I think it wasn’t that easy.
Anyway, I came across this Medium post by Dylan Meeus on how to scrape all the Kindle highlights from your Kindle page at Amazon. First, I didn’t know about this page, https://read.amazon.com/kp/notebook . Previously I clicked around inside Content and devices on the main Amazon page. Instead of following Dylan’s recommendation by having a full-blown Python scraper that logs in, I’ve been playing around with small JavaScript snippets lately, inspired by Simon Willison and his tools website . So I figured, why not translate Dylan’s approach to something that could be run in the browser? I asked Claude, who nailed it. The result is this gist , embedded below here.
Another thing I recently discovered, is the snippets function in Chrome devtools. Instead of manually pasting javascript into the browser console when you want to execute it, you can store snippets in the browser and invoke them a bit easier. They’re stored locally, not synced between devices, and therefore also easy to lose, I suspect. So you better save them somewhere else in addition.
So, navigate to https://read.amazon.com/kp/notebook and either paste this in the console and hit enter, or save it as a snippet and invoke it. This scans all you highlights from all your books and downloads them in a json format. If you prefer a different format, just ask ChatGPT or Claude to change the format in the script for you.
Happy highlighting!