From 141928ac7965f8c770f6309e608139d4c87c2aba Mon Sep 17 00:00:00 2001 From: yihong0618 Date: Sat, 15 Feb 2025 09:29:08 +0800 Subject: [PATCH] fix: English README since no kindle China Signed-off-by: yihong0618 --- README.md | 220 +++++++++++++++++++++++++++--------------------------- 1 file changed, 108 insertions(+), 112 deletions(-) diff --git a/README.md b/README.md index b02a4ff..248ec31 100644 --- a/README.md +++ b/README.md @@ -4,51 +4,50 @@ Download all your kindle books script. ![image](https://user-images.githubusercontent.com/15976103/172113700-7be0ae1f-1aae-4b50-8377-13047c63411b.png) -## **2024.01 亚马逊关了中国商店首页,你可以访问这个链接下载书 https://www.amazon.cn/hz/mycd/myx#/home/content/booksAll/dateDsc/** +## **2024.01 Amazon has shut down the China storefront homepage. You can download your books by visiting this link: https://www.amazon.cn/hz/mycd/myx#/home/content/booksAll/dateDsc/** -## 2023.06.26 如果你没有 kindle 实体设备可以用以下命令,下载后的 epub 在 EPUB 文件夹内。 +## 2023.06.26 If you don't have a physical Kindle device, you can use the following command. The downloaded EPUB files will be placed in the EPUB folder. -遇到 `AttributeError: 'NoneType' object has no attribute 'url'` 问题可用参考这个 https://github.com/yihong0618/Kindle_download_helper/issues/155#issuecomment-1928677849 +If you encounter the error `AttributeError: 'NoneType' object has no attribute 'url'`, please refer to: +https://github.com/yihong0618/Kindle_download_helper/issues/155#issuecomment-1928677849 ```console pip3 install -r requirements.txt python no_kindle.py -e ${email} -p ${password} -# 如果你想下载推送的书 +# To download push books python no_kindle.py -e ${email} -p ${password} --pdoc -# !!!!!! 亚马逊下架了中国区 web 商城,这个不好用了。 -# 你可以生成所有你电子书的购买记录,笔记记录来分析展示 +# !!!!!! Amazon has taken down the China web storefront. +# You can generate the purchase records and notes of all your e-books for data analysis python no_kindle.py -e ${email} -p ${password} --memory -# 支持导出全部标记书签及阅读信息(Clipping 信息)#153 +# Supports exporting all bookmarks and reading information (Clipping data) #153 python no_kindle.py -e ${email} -p ${password} --bookmark - ``` +## Installing Kindle_download_helper -## 安装 Kindle_download_helper +### GUI Application Download -### GUI 程序下载 - -到 [Release](https://github.com/yihong0618/Kindle_download_helper/releases) 页面查看最新版本,获取对应系统的二进制文件下载解压即可。 +Go to the [Release](https://github.com/yihong0618/Kindle_download_helper/releases) page, download the binary file for your system and extract it. ### Help -- 若打开二进制遇到问题,请参考 [#25](https://github.com/yihong0618/Kindle_download_helper/issues/25) -- kindle 无法下载问题,触发了亚马逊风控见 [#69](https://github.com/yihong0618/Kindle_download_helper/issues/69) -- Mac 新手指南 by @chongiscool,见 [#76](https://github.com/yihong0618/Kindle_download_helper/issues/76) +- If you encounter issues opening the binary, please refer to [#25](https://github.com/yihong0618/Kindle_download_helper/issues/25) +- For Kindle download issues (triggered by Amazon risk control), see [#69](https://github.com/yihong0618/Kindle_download_helper/issues/69) +- Mac beginner's guide by @chongiscool, see [#76](https://github.com/yihong0618/Kindle_download_helper/issues/76) -### Cli 安装使用 +### CLI Installation and Usage 1. python3 2. requirements ```python -python3 --version # 查看 python 版本 +python3 --version # check python version ``` ```python -pip3 install kindle_download # 使用 pip 安装 +pip3 install kindle_download # install via pip ``` ```bash @@ -60,7 +59,7 @@ pip3 install -r requirements.txt ``` ```python -python kindle.py -h # 查看使用参数 +python kindle.py -h # view usage parameters 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] @@ -98,67 +97,65 @@ optional arguments: --mode MODE Mode of download, all : download all files at once, sel: download selected files ``` +### Downloading Kindle Books -### 下载 kindle 书籍 - -尝试[自动获取 cookie](#%E8%87%AA%E5%8A%A8%E8%8E%B7%E5%8F%96-cookie)、csrfToken 进行下载 +Try to [automatically retrieve cookie](#automatic-cookie) and csrfToken for download ```python -python3 kindle.py --dedrm --cn ## --dedrm 移除 DRM +python3 kindle.py --dedrm --cn ## --dedrm to remove DRM ``` -(推荐) [手动输入 cookie](#%E8%8E%B7%E5%8F%96-cookie)、csrfToken 进行下载 +(Recommended) [Manually enter cookie](#retrieving-cookie) and csrfToken for download ```python -python3 kindle.py ${csrfToken} --cookie ${cookie} --dedrm --cn #下载国区 Kindle 书籍并移除 DRM -python3 kindle.py ${csrfToken} --cookie ${cookie} --dedrm #下载美区 Kindle 书籍 +python3 kindle.py ${csrfToken} --cookie ${cookie} --dedrm --cn # Download China-market books and remove DRM +python3 kindle.py ${csrfToken} --cookie ${cookie} --dedrm # Download US-market books ``` -默认下载所有文件,可以输入如下命令行来手动选择需要下载的书籍 +By default, all files are downloaded. To manually select which books to download, execute: ```python -python3 kindle.py --mode sel # "python3 kindle.py --pdoc --mode sel" for personal document +python3 kindle.py --mode sel # or "python3 kindle.py --pdoc --mode sel" for personal documents ``` -等程序获取到书籍列表后,程序会要求输入要下载的书籍序号: +After retrieving the book list, the program will prompt: ``` string Input the index of books you want to download, split by space (q to quit, l to list books). ``` -此时,在命令行中输入字母"q",然后回车则会退出下载;输入字母"l",再回车则会重新输出所有书籍列表。 -如要下载书籍,查看该书籍对应的 Index,然后在命令行输入(假设想下载第7,10,20本书): +To quit, type "q" and press Enter; type "l" and press Enter to re-display the book list. +To download books, input the corresponding indices (e.g., 7 10 20): ``` string 7 10 20 ``` -用空格隔开,最后回车即可。输入还支持range,比如输入 +Indices can also be specified with ranges, for example: ``` string 4 5 10:12 15 ``` -此时程序会下载第4,5,10,11,12,15本书籍。 +This downloads books 4, 5, 10, 11, 12, and 15. -### 获取 cookie +### Retrieving Cookie -若默认情况下提示 cookie 无效,你也可以手动输入 cookie。 -在上述 [全部书籍](https://www.amazon.cn/hz/mycd/myx#/home/content/booksAll/dateDsc/) 列表页面,按 `F12` 或右键点击——检查,进入网络面板 (Network),在 Name 栏找到任意一个 `ajax` 请求,右键复制 Request Headers 里的 `Cookie` 即可。同时也能在 Payload 里找到 `csrfToken`。 +If the cookie is reported as invalid by default, you can manually input it. +On the [all books](https://www.amazon.cn/hz/mycd/myx#/home/content/booksAll/dateDsc/) page, open the browser's developer tools (F12), go to the Network panel, locate any `ajax` request, and copy the `Cookie` from its request headers. The csrfToken can also be found in the Payload. -然后,执行 +Then run: ```python python3 kindle.py --cn --cookie ${cookie} ``` -你也可以把 cookie 保存为文本文件,执行 `python3 kindle.py --cookie-file ${cookie_file}` 下载书籍。 +You can also save the cookie to a text file and run `python3 kindle.py --cookie-file ${cookie_file}` to download books. -### 获取 CSRF Token +### Retrieving CSRF Token -若执行过程中提示获取 CSRF token 失败,你可以手动输入 CSRF Token。 - -`CSRF Token` 可以在页面源码中找到。在 [全部书籍](https://www.amazon.cn/hz/mycd/myx#/home/content/booksAll/dateDsc/) 列表页面右键点击,选择查看网页源码,再利用文本匹配工具 (Ctrl + F) 查找 `csrfToken`,将等号右边引号中的值复制出来,加到命令行参数中。 +If the process fails to obtain the CSRF token, you can manually input it. +The csrfToken can be found in the page source on the [all books](https://www.amazon.cn/hz/mycd/myx#/home/content/booksAll/dateDsc/) page. Right-click, view the page source, and search for `csrfToken` to copy its value. Then run: ```python # CSRF Token @@ -167,104 +164,103 @@ python3 kindle.py --cn ${csrfToken} python3 kindle.py --cn --cookie ${cookie} ${csrfToken} ``` -## 自动获取 cookie +## Automatically Retrieving Cookie -如果你的运行环境是本机,项目可以使用 [browser-cookie3](https://github.com/borisbabic/browser_cookie3) 库自动从浏览器中获取 cookie。 +If you are running on your local machine, the project can use the [browser-cookie3](https://github.com/borisbabic/browser_cookie3) library to automatically retrieve cookies from your browser. -### 使用 `amazon.cn` +### Using `amazon.cn` -1. 登陆 amazon.cn -2. 访问 -3. 右键查看源码,搜索 `csrfToken` 复制后面的 value -4. 执行 `python3 kindle.py --cn` -5. 如果下载推送文件 `python3 kindle.py --cn --pdoc` -5. 如果想直接 dedrm 解密 (不保证好用) `python3 kindle.py --cn --pdoc --dedrm` +1. Log in to amazon.cn +2. Visit +3. Right-click the page source and search for `csrfToken`, then copy its value +4. Run `python3 kindle.py --cn` +5. To download push files, run `python3 kindle.py --cn --pdoc` +6. To directly perform DRM removal (may not always work), run `python3 kindle.py --cn --pdoc --dedrm` -### how to `amazon.com` +### How to use `amazon.com` -1. login amazon.com -2. visit -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` +1. Log in to amazon.com +2. Visit +3. Right-click the page source, find the `csrfToken` and copy its value +4. Run: `python3 kindle.py` +5. For document files, run: `python3 kindle.py --pdoc` -### how to `amazon.de` +### How to use `amazon.de` -1. login amazon.de -2. visit -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` +1. Log in to amazon.de +2. Visit +3. Right-click the page source, find the `csrfToken` and copy its value +4. Run: `python3 kindle.py --de` +5. For document files, run: `python3 kindle.py --de --pdoc` -### how to `amazon.co.uk` +### How to use `amazon.co.uk` -1. login amazon.co.uk -2. visit -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` +1. Log in to amazon.co.uk +2. Visit +3. Right-click the page source, find the `csrfToken` and copy its value +4. Run: `python3 kindle.py --uk` +5. For document files, run: `python3 kindle.py --uk --pdoc` -### `amazon.jp` を使用する +### Using `amazon.jp` -1. amazon.co.jp にログインする。 -2. ホームページ )にアクセスする。 -3. ソースコード上で右クリックし、`csrfToken`を検索して、それ以降の値をコピーします。 -4. `python3 kindle.py --jp` を実行する。 -5. プッシュファイルをダウンロードする場合 `python3 kindle.py --jp --pdoc` +1. Log in to amazon.co.jp +2. Visit +3. Right-click the page source, search for `csrfToken`, and copy its value +4. Run: `python3 kindle.py --jp` +5. To download push files, run: `python3 kindle.py --jp --pdoc` +## Notes -## 注意 - -- cookie 和 csrf token 会过期,重新刷新下 amazon 的页面就行 -- 程序会自动在命令执行的目录下创建 `DOWNLOADS` 目录,书会下载在 `DOWNLOADS` 里 -- 支持 mobi 类型的文件直接 dedrm `--dedrm` 生成的文件在 `DEDRMS` 里 -- 如果你用 [DeDRM_tools](https://github.com/apprenticeharper/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 两种格式 +- Cookie and CSRF token will expire; simply refresh the Amazon page. +- The program will automatically create a `DOWNLOADS` directory in the current working directory; downloaded books will be stored there. +- Supports directly dedrm-ing mobi files with `--dedrm`; processed files are saved in the `DEDRMS` folder. +- If you use [DeDRM_tools](https://github.com/apprenticeharper/DeDRM_tools) to decrypt, the key is stored in key.txt. +- Alternatively, you can simply drag the file into Calibre (please google it). +- If the process fails, you can use e.g. `--resume-from ${num}` +- If a file name is too long, add `--cut-length 70` to truncate it. +- Supports downloading push files with `--pdoc`. +- If there are many duplicate pdoc or book names, you can use `--resolve_duplicate_names` to resolve conflicts. +- Error logs are recorded in .error_books.log. +- Supports generating a README of recently finished books with `--readme`; the file is generated as `my_kindle_stats.md`. +- Supports dedrm-ing mobi files directly using `--dedrm`; the output files are placed in `DEDRMS`. +- The script `dedrm.py` is used to decrypt downloaded e-book files independently, outputting both azw and epub formats by default. ``` -# 其中后 3 个参数,仅在必要时指定,用法 python3 dedrm.py 1源目录 2目标目录 3密钥 4输出格式 -# 例如对 ebook 中的文件解密,并只生成 epub 格式的 dedrm 文件 -$ python3 dedrm.py ebook DeDRMed key.txt中的密钥串 epub +# For the latter three parameters, only specify if necessary. Usage: python3 dedrm.py +# For example, to decrypt files in the "ebook" directory and generate dedrm files in epub format only: +$ python3 dedrm.py ebook DeDRMed "key_string_from_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](https://github.com/apprenticeharper/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` +- The cookie and csrf token will expire; just refresh the Amazon page. +- The program automatically creates a `DOWNLOADS` directory in the working directory. Books are downloaded there. +- If you use [DeDRM_tools](https://github.com/apprenticeharper/DeDRM_tools) for decryption, the key is stored in key.txt. +- Alternatively, just drop the file into Calibre—please google it. +- If the process fails, you can use e.g. `--resume-from ${num}` +- If file names are too long, add `--cut-length 70` to truncate them. +- Supports downloading push files with `--pdoc` +- Use `--resolve_duplicate_names` to resolve conflicts with duplicate names. +- Error logs are saved in .error_books.log. +- Supports generating a README for recently finished books via `--readme`, which outputs to `my_kindle_stats.md` ![image](https://user-images.githubusercontent.com/15976103/172113475-92862b57-bb39-4cd7-84d5-6bc428172bc4.png) -## 贡献 +## Contributions -1. Any issues PR welcome -2. `black kindle.py kindle_gui.py` +1. Any issue or PR is welcome. +2. Run `black kindle.py kindle_gui.py` -## 感谢 +## Acknowledgements - @[Kindle](https://zh.m.wikipedia.org/zh/Kindle) - @[DeDRM_tools](https://github.com/apprenticeharper/DeDRM_tools) -- @[frostming](https://github.com/frostming) GUI and a lot of work -- @[bladewang](https://github.com/bladewang) PDOC download -- @[athrowaway2021](https://github.com/athrowaway2021/comix) No need to have a real kindle +- @[frostming](https://github.com/frostming) – GUI and many contributions +- @[bladewang](https://github.com/bladewang) – PDOC download +- @[athrowaway2021](https://github.com/athrowaway2021/comix) – No need to have a real Kindle -## 赞赏 +## Appreciation -- 谢谢就够了 +Thank you is enough ## Enjoy