fix: English README since no kindle China

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
This commit is contained in:
yihong0618
2025-02-15 09:29:08 +08:00
parent 1a5ec4ed46
commit 141928ac79

220
README.md
View File

@@ -4,51 +4,50 @@ Download all your kindle books script.
![image](https://user-images.githubusercontent.com/15976103/172113700-7be0ae1f-1aae-4b50-8377-13047c63411b.png) ![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 ```console
pip3 install -r requirements.txt pip3 install -r requirements.txt
python no_kindle.py -e ${email} -p ${password} python no_kindle.py -e ${email} -p ${password}
# 如果你想下载推送的书 # To download push books
python no_kindle.py -e ${email} -p ${password} --pdoc 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 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 python no_kindle.py -e ${email} -p ${password} --bookmark
``` ```
## Installing Kindle_download_helper
## 安装 Kindle_download_helper ### GUI Application Download
### GUI 程序下载 Go to the [Release](https://github.com/yihong0618/Kindle_download_helper/releases) page, download the binary file for your system and extract it.
到 [Release](https://github.com/yihong0618/Kindle_download_helper/releases) 页面查看最新版本,获取对应系统的二进制文件下载解压即可。
### Help ### Help
- 若打开二进制遇到问题,请参考 [#25](https://github.com/yihong0618/Kindle_download_helper/issues/25) - If you encounter issues opening the binary, please refer to [#25](https://github.com/yihong0618/Kindle_download_helper/issues/25)
- kindle 无法下载问题,触发了亚马逊风控见 [#69](https://github.com/yihong0618/Kindle_download_helper/issues/69) - For Kindle download issues (triggered by Amazon risk control), see [#69](https://github.com/yihong0618/Kindle_download_helper/issues/69)
- Mac 新手指南 by @chongiscool,见 [#76](https://github.com/yihong0618/Kindle_download_helper/issues/76) - Mac beginner's guide by @chongiscool, see [#76](https://github.com/yihong0618/Kindle_download_helper/issues/76)
### Cli 安装使用 ### CLI Installation and Usage
1. python3 1. python3
2. requirements 2. requirements
```python ```python
python3 --version # 查看 python 版本 python3 --version # check python version
``` ```
```python ```python
pip3 install kindle_download # 使用 pip 安装 pip3 install kindle_download # install via pip
``` ```
```bash ```bash
@@ -60,7 +59,7 @@ pip3 install -r requirements.txt
``` ```
```python ```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] 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] [--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 --mode MODE Mode of download, all : download all files at once, sel: download selected files
``` ```
### Downloading Kindle Books
### 下载 kindle 书籍 Try to [automatically retrieve cookie](#automatic-cookie) and csrfToken for download
尝试[自动获取 cookie](#%E8%87%AA%E5%8A%A8%E8%8E%B7%E5%8F%96-cookie)、csrfToken 进行下载
```python ```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 ```python
python3 kindle.py ${csrfToken} --cookie ${cookie} --dedrm --cn #下载国区 Kindle 书籍并移除 DRM python3 kindle.py ${csrfToken} --cookie ${cookie} --dedrm --cn # Download China-market books and remove DRM
python3 kindle.py ${csrfToken} --cookie ${cookie} --dedrm #下载美区 Kindle 书籍 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 ```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 ``` string
Input the index of books you want to download, split by space (q to quit, l to list books). Input the index of books you want to download, split by space (q to quit, l to list books).
``` ```
此时,在命令行中输入字母"q",然后回车则会退出下载;输入字母"l",再回车则会重新输出所有书籍列表。 To quit, type "q" and press Enter; type "l" and press Enter to re-display the book list.
如要下载书籍,查看该书籍对应的 Index然后在命令行输入假设想下载第71020本书): To download books, input the corresponding indices (e.g., 7 10 20):
``` string ``` string
7 10 20 7 10 20
``` ```
用空格隔开最后回车即可。输入还支持range比如输入 Indices can also be specified with ranges, for example:
``` string ``` string
4 5 10:12 15 4 5 10:12 15
``` ```
此时程序会下载第4510111215本书籍。 This downloads books 4, 5, 10, 11, 12, and 15.
### 获取 cookie ### Retrieving Cookie
若默认情况下提示 cookie 无效,你也可以手动输入 cookie。 If the cookie is reported as invalid by default, you can manually input it.
在上述 [全部书籍](https://www.amazon.cn/hz/mycd/myx#/home/content/booksAll/dateDsc/) 列表页面,按 `F12` 或右键点击——检查,进入网络面板 (Network),在 Name 栏找到任意一个 `ajax` 请求,右键复制 Request Headers 里的 `Cookie` 即可。同时也能在 Payload 里找到 `csrfToken`。 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 ```python
python3 kindle.py --cn --cookie ${cookie} 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 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:
`CSRF Token` 可以在页面源码中找到。在 [全部书籍](https://www.amazon.cn/hz/mycd/myx#/home/content/booksAll/dateDsc/) 列表页面右键点击,选择查看网页源码,再利用文本匹配工具 (Ctrl + F) 查找 `csrfToken`,将等号右边引号中的值复制出来,加到命令行参数中。
```python ```python
# CSRF Token # CSRF Token
@@ -167,104 +164,103 @@ python3 kindle.py --cn ${csrfToken}
python3 kindle.py --cn --cookie ${cookie} ${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 1. Log in to amazon.cn
2. 访问 <https://www.amazon.cn/hz/mycd/myx#/home/content/booksAll/dateDsc/> 2. Visit <https://www.amazon.cn/hz/mycd/myx#/home/content/booksAll/dateDsc/>
3. 右键查看源码,搜索 `csrfToken` 复制后面的 value 3. Right-click the page source and search for `csrfToken`, then copy its value
4. 执行 `python3 kindle.py --cn` 4. Run `python3 kindle.py --cn`
5. 如果下载推送文件 `python3 kindle.py --cn --pdoc` 5. To download push files, run `python3 kindle.py --cn --pdoc`
5. 如果想直接 dedrm 解密 (不保证好用) `python3 kindle.py --cn --pdoc --dedrm` 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 1. Log in to amazon.com
2. visit <https://www.amazon.com/hz/mycd/myx#/home/content/booksAll/dateDsc/> 2. Visit <https://www.amazon.com/hz/mycd/myx#/home/content/booksAll/dateDsc/>
3. right click this page source then find `csrfToken` value copy 3. Right-click the page source, find the `csrfToken` and copy its value
4. run: `python3 kindle.py` 4. Run: `python3 kindle.py`
5. if is doc file `python3 kindle.py --pdoc` 5. For document files, run: `python3 kindle.py --pdoc`
### how to `amazon.de` ### How to use `amazon.de`
1. login amazon.de 1. Log in to amazon.de
2. visit <https://www.amazon.de/hz/mycd/myx#/home/content/booksAll/dateDsc/> 2. Visit <https://www.amazon.de/hz/mycd/myx#/home/content/booksAll/dateDsc/>
3. right click this page source then find `csrfToken` value copy 3. Right-click the page source, find the `csrfToken` and copy its value
4. run: `python3 kindle.py --de` 4. Run: `python3 kindle.py --de`
5. if is doc file `python3 kindle.py --de --pdoc` 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 1. Log in to amazon.co.uk
2. visit <https://www.amazon.co.uk/hz/mycd/myx#/home/content/booksAll/dateDsc/> 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 3. Right-click the page source, find the `csrfToken` and copy its value
4. run: `python3 kindle.py --uk` 4. Run: `python3 kindle.py --uk`
5. if is doc file `python3 kindle.py --uk --pdoc` 5. For document files, run: `python3 kindle.py --uk --pdoc`
### `amazon.jp` を使用する ### Using `amazon.jp`
1. amazon.co.jp にログインする。 1. Log in to amazon.co.jp
2. ホームページ <https://www.amazon.co.jp/hz/mycd/myx#/home/content/booksAll/dateDsc/>)にアクセスする。 2. Visit <https://www.amazon.co.jp/hz/mycd/myx#/home/content/booksAll/dateDsc/>
3. ソースコード上で右クリックし、`csrfToken`を検索して、それ以降の値をコピーします。 3. Right-click the page source, search for `csrfToken`, and copy its value
4. `python3 kindle.py --jp` を実行する。 4. Run: `python3 kindle.py --jp`
5. プッシュファイルをダウンロードする場合 `python3 kindle.py --jp --pdoc` 5. To download push files, run: `python3 kindle.py --jp --pdoc`
## Notes
## 注意 - 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.
- cookie 和 csrf token 会过期,重新刷新下 amazon 的页面就行 - Supports directly dedrm-ing mobi files with `--dedrm`; processed files are saved in the `DEDRMS` folder.
- 程序会自动在命令执行的目录下创建 `DOWNLOADS` 目录,书会下载在 `DOWNLOADS` 里 - If you use [DeDRM_tools](https://github.com/apprenticeharper/DeDRM_tools) to decrypt, the key is stored in key.txt.
- 支持 mobi 类型的文件直接 dedrm `--dedrm` 生成的文件在 `DEDRMS` 里 - Alternatively, you can simply drag the file into Calibre (please google it).
- 如果你用 [DeDRM_tools](https://github.com/apprenticeharper/DeDRM_tools) 解密 key 存在 key.txt 里 - If the process fails, you can use e.g. `--resume-from ${num}`
- 或者直接拖进 Calibre 里 please google it. - If a file name is too long, add `--cut-length 70` to truncate it.
- 如果过程中失败了可以使用 e.g. `--resume-from ${num}` - Supports downloading push files with `--pdoc`.
- 如果出现名字太长的报错可以增加:`--cut-length 70` 来截断文件名 - If there are many duplicate pdoc or book names, you can use `--resolve_duplicate_names` to resolve conflicts.
- 支持推送文件下载 `--pdoc` - Error logs are recorded in .error_books.log.
- 如果有很多同名 pdoc 或 book 可以使用 `--resolve_duplicate_names` 解决同名冲突 - Supports generating a README of recently finished books with `--readme`; the file is generated as `my_kindle_stats.md`.
- error log 记录在 .error_books.log 中 - Supports dedrm-ing mobi files directly using `--dedrm`; the output files are placed in `DEDRMS`.
- 支持生成最近读完书的 README `--readme` 生成的文件在 `my_kindle_stats.md` 中 - The script `dedrm.py` is used to decrypt downloaded e-book files independently, outputting both azw and epub formats by default.
- 支持 mobi 类型的文件直接 dedrm `--dedrm` 生成的文件在 `DEDRMS` 里
- 脚本 `dedrm.py` 用于单独解密已下载的电子书文件,默认同时输出 azw 和 epub 两种格式
``` ```
# 其中后 3 个参数,仅在必要时指定,用法 python3 dedrm.py 1源目录 2目标目录 3密钥 4输出格式 # For the latter three parameters, only specify if necessary. Usage: python3 dedrm.py <source_directory> <target_directory> <key> <output_format>
# 例如对 ebook 中的文件解密,并只生成 epub 格式的 dedrm 文件 # For example, to decrypt files in the "ebook" directory and generate dedrm files in epub format only:
$ python3 dedrm.py ebook DeDRMed key.txt中的密钥串 epub $ python3 dedrm.py ebook DeDRMed "key_string_from_key.txt" epub
``` ```
## Note ## Note
- The cookie and csrf token will expire, just refresh the amazon page again. - The cookie and csrf token will expire; just refresh the Amazon page.
- The program will automatically create `DOWNLOADS` directory under the command execution directory, the book will be downloaded in `DOWNLOADS` directory. - 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) to decrypt the key, it will be stored in key.txt - If you use [DeDRM_tools](https://github.com/apprenticeharper/DeDRM_tools) for decryption, the key is stored in key.txt.
- or just drag it into Calibre. Please google it. - Alternatively, just drop the file into Calibre—please google it.
- If the process fails you can use e.g. `--resume-from ${num}` - 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 - If file names are too long, add `--cut-length 70` to truncate them.
- Support push file download `--pdoc` - Supports downloading push files with `--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. - Use `--resolve_duplicate_names` to resolve conflicts with duplicate names.
- error log is logged in .error_books.log - Error logs are saved in .error_books.log.
- Support for generating READMEs of recently finished books `--readme` generated files are in `my_kindle_stats.md` - 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) ![image](https://user-images.githubusercontent.com/15976103/172113475-92862b57-bb39-4cd7-84d5-6bc428172bc4.png)
## 贡献 ## Contributions
1. Any issues PR welcome 1. Any issue or PR is welcome.
2. `black kindle.py kindle_gui.py` 2. Run `black kindle.py kindle_gui.py`
## 感谢 ## Acknowledgements
- @[Kindle](https://zh.m.wikipedia.org/zh/Kindle) - @[Kindle](https://zh.m.wikipedia.org/zh/Kindle)
- @[DeDRM_tools](https://github.com/apprenticeharper/DeDRM_tools) - @[DeDRM_tools](https://github.com/apprenticeharper/DeDRM_tools)
- @[frostming](https://github.com/frostming) GUI and a lot of work - @[frostming](https://github.com/frostming) GUI and many contributions
- @[bladewang](https://github.com/bladewang) PDOC download - @[bladewang](https://github.com/bladewang) PDOC download
- @[athrowaway2021](https://github.com/athrowaway2021/comix) No need to have a real kindle - @[athrowaway2021](https://github.com/athrowaway2021/comix) No need to have a real Kindle
## 赞赏 ## Appreciation
- 谢谢就够了 Thank you is enough
## Enjoy ## Enjoy