parsing and exporting kindle clippings, as well as syncing them with Zotero. I made this tool so that I could read and annotate papers on my kindle, and then send them back to my Zotero library without too much manual work.
This tool has not been thoroughly tested, and thus can behave unexpectedly. It directly interacts with your Zotero library (and indirectly with your Kindle device) and thus might delete your entire library, brick your kindle, or a wide variety of other unpleasant things. USE AT YOUR OWN RISK
- clone the repo and install the minimal requirements.
git clone https://github.com/mivanit/kindle-clippings-zotero kindle-clippings-zotero
cd kindle-clippings-zotero
pip install -r requirements.txt
-
copy the file
__zotero_api__.json.TEMPLATE
to create a file__zotero_api__.json
. Replace the dummy key and url with whatever you'd like. See the Zotero API docs for information on how to get your library ID and an API key. -
Done!
Note: the only dependencies are
urllib3
andpyzotero
. Eventually, I'd like to depend only on the former -- but for now, direct calls to the Zotero api throughurllib3
are made.
data will be written to the parent directory. It is expected that a file CLIPPINGS_FILENAME : str = "../My Clippings.txt"
exists relative to the directory the script is run from. I recommend a separate script to copy the clippings file to the appropriate location. On my kindle, it is found at "Kindle/documents/My Clippings.txt"
.
Note: I have not figured out a way to access the kindle clippings (for non-kindle-store items) from the desktop or web readers, although I know that the clippings data must be uploaded somehow, since it can (usually) be accessed from a mobile device. If you figure out how to interact with Amazon's API and get this data, please let me know! For now, I need to physically plug my kindle into my machine.
to a json
file mapping titles to lists of clipping items
python parse_kindle_clippings.py data_sorted <output>
Takes in a raw clippings file file_in
, and outputs a sorted json
to json_out
, as well as markdown files with clippings to the directory out_dir
python parse_kindle_clippings.py md_sorted <file_in> <out_dir> <json_out>
relies on existing exported json
, pass this as data_json_path
. For each item (identified by title), it stores in the cache file zotero_kindle_cache.json
whether to ignore the clippings, postpone and prompt the user next time, or a Zotero item key to be used as the parent item. If the user is prompted, you can specify 'a'
or 'add'
to get a list of possible matches and their Zotero keys (you can also specify any key you wish, but be careful)
python parse_kindle_clippings.py zotero_upload_all <data_json_path>