As of early 2023, it's likely the script doesn't work due to API changes.
Do something useful with your Kindle notes :) This script extracts individual words from
My Clippings
file hidden on your Kindle e-reader, translates them using Google Translate and exports the pair "original word" → "translation" into a.txt
file from which you can learn these words or import them into an application such as Quizlet.
Script skips sentences, numbers, special characters, etc. — only single words are being translated. Words in desired language are skipped.
deep-translator
works very slowly with Google Translate so we need to do a little tweak first. Install the package and go to the location where deep-translator
is installed:
pip install deep-translator
pip show deep-translator
Open google_trans.py
& go to line 177. Edit:
# sleep(2) # => ~ 33.33 mins to translate 1000 words
sleep(0.1) # => ~ 1.66 mins to translate 1000 words
Save.
- Connect your Kindle via USB cable to your computer.
- Download
script.zip
from Releases. - Go to the download location, unzip & run
script.exe
. - Write source & target languages or wait if defaults (
en
&pl
) are ok. - Write drive letter associated with Kindle or wait if default (
D
) is ok. - Wait a few minutes - words are being translated.
- Go to
script\output\kindle-words_export.txt
to check exported file. - (optional) Add it to Quizlet.
- Voilà ✨
- Connect your Kindle via USB cable to your Mac.
- Clone or download this repo.
- Open Terminal/iTerm and install necessary packages (use
pip
orpip3
):
pip install inputimeout
pip install deep-translator
pip install pync
pip install langdetect
- Navigate to the folder you cloned/downloaded & run the script:
cd '/Users/USER/Downloads/kindle-words'
python script.py
- Write source & target languages or wait if defaults (
en
&pl
) are ok. - Write your Kindle's name or wait if default (
Kindle
) is ok. - Wait a few minutes - words are being translated.
- Go to
output/kindle-words_export.txt
to check exported file. - (optional) Add it to Quizlet.
- Voilà ✨
- 🎯 Dictionary definitions. (Need a different API)
- ✅
Improve regex formula to better deal with words that have special characters. - ✅
Extract single words from source file. - ✅
Output list line by line. - ✅
Use API to translate words. - ✅
Skip the same words on subsequent imports. - ❌
Use DeepL rather than Google Translate.(Requires paid subscription)
- 1.6: Added backup functionality to save
My Clippings
file locally. - 1.5.2: Added one more rule to clean the data.
- 1.5.1: Fixed Windows 10 notifications bug.
- 1.5: Added language detection to skip translation of words already in desired language.
- 1.4: Added notifications for macOS & Windows.
- 1.3: Added support for macOS.
- 1.2.1: Added
try/except
to fix aFileNotFoundError
error. - 1.2: Fixed
io.open
bug; added sometry/except
to catch more errors; re-enabledtimeout_time
; addedlast_word
export so it's easy to see which words are new and which are old. Published in Releases. - 1.1: Quite a big re-write: it now works properly with
My Clippings.txt
file from Kindle - all bugs are fixed. Initial run takes ~ 10 minutes to complete (depending on the size of your file) but afterwards it's usually < 1 minute because data from previous run is stored locally for comparison - only new words are being translated to save time and improve speed. - 1.0.0: Using new backend - deep-translator.
- 0.12.5: Bug in the API discovered.
- 0.12.4: Cleared up the code for better readability.
- 0.12.3: Fixes to
regex
formula so it also takes words with,
&—
. - 0.12.2: Print which folder was created for exported files.
- 0.12.1: Renamed variables & export files' names to improve readability.
- 0.12: Be able to select source & target languages.
- 0.11: Added input timeout.
- 0.10: Take input file directly from Kindle once drive letter is given.
- 0.9: Export files to specific folders based on today's date & ID.
- 0.8: Add script runtime info.
- 0.7: Fixes to
regex
formula so it also takes words with.
,-
&"
. - 0.6: Print translations directly to
kindle-words_export-{DATE}.txt
. - 0.5: No more duplicate words.
- 0.4: Fixed
charmap' codec can't encode character (...)
problem that occured with PL characters. - 0.3: Translation with googletrans lib.
- 0.2: Output list line by line + export to a
.txt.
file. - 0.1: Initial release. Extract single words from source file using
regex
.
Using SemVer.
- Text Translation with Google Translate API in Python
- Change python 3.7 default encoding from cp1252 to cp65001 aka UTF-8
- Print lists in Python
- Writing to a File with Python's print() Function
- Python switch case
- Using .write function with multiple arguments for writing to a txt file - Python
If you found a bug or want to propose a feature, feel free to visit the Issues page.