Kindle_download_helper

Download all your kindle books script.

GPL-3.0 License

Downloads
118
Stars
2.4K
Committers
20

Kindle_download_helper

Download all your kindle books script.

2024.01 https://www.amazon.cn/hz/mycd/myx#/home/content/booksAll/dateDsc/

2023.06.26 kindle epub EPUB

AttributeError: 'NoneType' object has no attribute 'url' https://github.com/yihong0618/Kindle_download_helper/issues/155#issuecomment-1928677849

pip3 install -r requirements.txt
python no_kindle.py -e ${email} -p ${password}

# 
python no_kindle.py -e ${email} -p ${password} --pdoc

# !!!!!!  web 
# 
python no_kindle.py -e ${email} -p ${password} --memory

# Clipping #153
python no_kindle.py -e ${email} -p ${password} --bookmark

Kindle_download_helper

GUI

Release

Help

Cli

  1. python3
  2. requirements
python3 --version  #  python 
pip3 install kindle_download  #  pip 
git clone https://github.com/yihong0618/Kindle_download_helper.git && cd Kindle_download_helper
pip3 install -r requirements.txt
python kindle.py -h # 

usage: kindle.py [-h] [--cookie COOKIE | --cookie-file COOKIE_FILE] [--cn] [--jp] [--de] [--uk] [--resume-from INDEX] [--cut-length CUT_LENGTH] [-o OUTDIR] [-od OUTDEDRMDIR] [-s SESSION_FILE] [--pdoc]
                 [--resolve_duplicate_names] [--readme] [--dedrm] [--list] [--device_sn DEVICE_SN] [--mode MODE]
                 [csrf_token]

positional arguments:
  csrf_token            amazon or amazon cn csrf token

optional arguments:
  -h, --help            show this help message and exit
  --cookie COOKIE       amazon or amazon cn cookie
  --cookie-file COOKIE_FILE
                        load cookie local file
  --cn                  if your account is an amazon.cn account
  --jp                  if your account is an amazon.co.jp account
  --de                  if your account is an amazon.de account
  --uk                  if your account is an amazon.co.uk account
  --resume-from INDEX   resume from the index if download failed
  --cut-length CUT_LENGTH
                        truncate the file name
  -o OUTDIR, --outdir OUTDIR
                        download output dir
  -od OUTDEDRMDIR, --outdedrmdir OUTDEDRMDIR
                        download output dedrm dir
  -s SESSION_FILE, --session-file SESSION_FILE
                        The reusable session dump file
  --pdoc                to download personal documents or ebook
  --resolve_duplicate_names
                        Resolve duplicate names files to download
  --readme              If you want to generate kindle readme stats
  --dedrm               If you want to `dedrm` directly
  --list                just list books/pdoc, not to download
  --device_sn DEVICE_SN
                        Download file for device with this serial number
  --mode MODE           Mode of download, all : download all files at once, sel: download selected files

kindle

cookiecsrfToken

python3 kindle.py  --dedrm --cn  ## --dedrm  DRM

() cookiecsrfToken

python3 kindle.py ${csrfToken} --cookie ${cookie} --dedrm --cn # Kindle  DRM
python3 kindle.py ${csrfToken} --cookie ${cookie} --dedrm # Kindle 
python3 kindle.py --mode sel # "python3 kindle.py --pdoc --mode sel" for personal document
Input the index of books you want to download, split by space (q to quit, l to list books).

"q""l" Index71020

7 10 20

range

4 5 10:12 15

4510111215

cookie

cookie cookie F12 (Network) Name ajax Request Headers Cookie Payload csrfToken

python3 kindle.py --cn --cookie ${cookie}

cookie python3 kindle.py --cookie-file ${cookie_file}

CSRF Token

CSRF token CSRF Token

CSRF Token (Ctrl + F) csrfToken

# CSRF Token
python3 kindle.py --cn ${csrfToken}
# Both cookie and CSRF Token
python3 kindle.py --cn --cookie ${cookie} ${csrfToken}

cookie

browser-cookie3 cookie

amazon.cn

  1. amazon.cn
  2. https://www.amazon.cn/hz/mycd/myx#/home/content/booksAll/dateDsc/
  3. csrfToken value
  4. python3 kindle.py --cn
  5. python3 kindle.py --cn --pdoc
  6. dedrm () python3 kindle.py --cn --pdoc --dedrm

how to amazon.com

  1. login amazon.com
  2. visit https://www.amazon.com/hz/mycd/myx#/home/content/booksAll/dateDsc/
  3. right click this page source then find csrfToken value copy
  4. run: python3 kindle.py
  5. if is doc file python3 kindle.py --pdoc

how to amazon.de

  1. login amazon.de
  2. visit https://www.amazon.de/hz/mycd/myx#/home/content/booksAll/dateDsc/
  3. right click this page source then find csrfToken value copy
  4. run: python3 kindle.py --de
  5. if is doc file python3 kindle.py --de --pdoc

how to amazon.co.uk

  1. login amazon.co.uk
  2. visit https://www.amazon.co.uk/hz/mycd/myx#/home/content/booksAll/dateDsc/
  3. right click this page source then find csrfToken value copy
  4. run: python3 kindle.py --uk
  5. if is doc file python3 kindle.py --uk --pdoc

amazon.jp

  1. amazon.co.jp
  2. https://www.amazon.co.jp/hz/mycd/myx#/home/content/booksAll/dateDsc/
  3. csrfToken
  4. python3 kindle.py --jp
  5. python3 kindle.py --jp --pdoc

  • cookie csrf token amazon
  • DOWNLOADS DOWNLOADS
  • mobi dedrm --dedrm DEDRMS
  • DeDRM_tools key key.txt
  • Calibre please google it.
  • e.g. --resume-from ${num}
  • --cut-length 70
  • --pdoc
  • pdoc book --resolve_duplicate_names
  • error log .error_books.log
  • README --readme my_kindle_stats.md
  • mobi dedrm --dedrm DEDRMS
  • dedrm.py azw epub
#  3  python3 dedrm.py 1 2 3 4
#    ebook  epub  dedrm 
$ python3 dedrm.py ebook DeDRMed key.txt epub

Note

  • The cookie and csrf token will expire, just refresh the amazon page again.
  • The program will automatically create DOWNLOADS directory under the command execution directory, the book will be downloaded in DOWNLOADS directory.
  • If you use DeDRM_tools to decrypt the key, it will be stored in key.txt
  • or just drag it into Calibre. Please google it.
  • If the process fails you can use e.g. --resume-from ${num}
  • If the name is too long, you can add: -cut-length 70 to truncate the file name
  • Support push file download --pdoc
  • If there are many pdocs or books with the same name, you can use --resolve_duplicate_names to resolve conflicts with the same name.
  • error log is logged in .error_books.log
  • Support for generating READMEs of recently finished books --readme generated files are in my_kindle_stats.md

  1. Any issues PR welcome
  2. black kindle.py kindle_gui.py

Enjoy