Skip to content

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.

License

Notifications You must be signed in to change notification settings

vardecab/kindle-words

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kindle-words

Not Maintained

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.

Screenshots

output macOS notification nothing sets in Quizlet

How to use

Speed things up ⚡

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.

Windows

  1. Connect your Kindle via USB cable to your computer.
  2. Download script.zip from Releases.
  3. Go to the download location, unzip & run script.exe.
  4. Write source & target languages or wait if defaults (en & pl) are ok.
  5. Write drive letter associated with Kindle or wait if default (D) is ok.
  6. Wait a few minutes - words are being translated.
  7. Go to script\output\kindle-words_export.txt to check exported file.
  8. (optional) Add it to Quizlet.
  9. Voilà ✨

macOS

  1. Connect your Kindle via USB cable to your Mac.
  2. Clone or download this repo.
  3. Open Terminal/iTerm and install necessary packages (use pip or pip3):
pip install inputimeout
pip install deep-translator 
pip install pync
pip install langdetect
  1. Navigate to the folder you cloned/downloaded & run the script:
cd '/Users/USER/Downloads/kindle-words'
python script.py
  1. Write source & target languages or wait if defaults (en & pl) are ok.
  2. Write your Kindle's name or wait if default (Kindle) is ok.
  3. Wait a few minutes - words are being translated.
  4. Go to output/kindle-words_export.txt to check exported file.
  5. (optional) Add it to Quizlet.
  6. Voilà ✨

Roadmap

  • 🎯 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)

Release History

  • 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 a FileNotFoundError error.
  • 1.2: Fixed io.open bug; added some try/except to catch more errors; re-enabled timeout_time; added last_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.

Versioning

Using SemVer.

License

Acknowledgements

Packages

Articles

Tools

Other

Contributing

If you found a bug or want to propose a feature, feel free to visit the Issues page.

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Languages