getnotes-cli 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,71 @@
1
+ ---
2
+ description: How to automate the release of getnotes-cli to PyPI
3
+ ---
4
+
5
+ # Release Process
6
+
7
+ // turbo-all
8
+
9
+ ## Steps
10
+
11
+ 1. Configure Python path and UV
12
+ ```bash
13
+ export PATH="$HOME/.cargo/bin:$PATH"
14
+ ```
15
+
16
+ 2. Read the current version from pyproject.toml
17
+ ```bash
18
+ CURRENT_VERSION=$(grep -m 1 '^version = ' pyproject.toml | cut -d '"' -f 2)
19
+ echo "Current version is: $CURRENT_VERSION"
20
+ ```
21
+
22
+ 3. Ensure you're on the main branch and it's up to date
23
+ ```bash
24
+ git checkout main
25
+ git pull origin main
26
+ ```
27
+
28
+ 4. Ask the user for the new version number
29
+ ```bash
30
+ # INTERACTIVE: Ask user for the new version number (e.g., 0.1.1)
31
+ # Note: You can skip modifying the version and just use the CURRENT_VERSION
32
+ ```
33
+
34
+ 5. Bump version in pyproject.toml
35
+ ```bash
36
+ # ONLY RUN THIS if the user provided a NEW_VERSION. Skip if using CURRENT_VERSION.
37
+ # Replace NEW_VERSION with the version provided by the user
38
+ NEW_VERSION="WAITING_FOR_USER"
39
+ sed -i '' "s/version = \"$CURRENT_VERSION\"/version = \"$NEW_VERSION\"/" pyproject.toml
40
+ ```
41
+
42
+ 6. Update `CHANGELOG.md` with the new version entry (ask user for details if needed)
43
+
44
+ 7. Commit all changes:
45
+ ```bash
46
+ # Set TARGET_VERSION based on user's choice
47
+ # TARGET_VERSION=$NEW_VERSION or TARGET_VERSION=$CURRENT_VERSION
48
+ TARGET_VERSION="WAITING_FOR_USER"
49
+ git add pyproject.toml CHANGELOG.md
50
+ git commit -m "chore: release v$TARGET_VERSION"
51
+ ```
52
+
53
+ 8. Push and tag:
54
+ ```bash
55
+ git tag "v$TARGET_VERSION"
56
+ git push origin main
57
+ git push origin "v$TARGET_VERSION"
58
+ ```
59
+
60
+ 9. Create a GitHub release to trigger PyPI publish:
61
+ ```bash
62
+ gh release create "v$TARGET_VERSION" --title "v$TARGET_VERSION" --generate-notes
63
+ ```
64
+
65
+ ## Checklist
66
+
67
+ - [ ] Version bumped in `pyproject.toml` (if requested)
68
+ - [ ] CHANGELOG updated
69
+ - [ ] Committed and pushed
70
+ - [ ] Tagged and pushed tag
71
+ - [ ] GitHub release created (triggers PyPI publish via publish.yml)
@@ -0,0 +1,31 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published] # 监听 GitHub Release 发布事件
6
+
7
+ jobs:
8
+ pypi-publish:
9
+ name: Build & Publish Release to PyPI
10
+ runs-on: ubuntu-latest
11
+
12
+ # 获取 OIDC Token 的必要权限,用于免密认证 PyPI
13
+ permissions:
14
+ id-token: write
15
+ contents: read
16
+
17
+ steps:
18
+ - name: Checkout target repository
19
+ uses: actions/checkout@v4
20
+
21
+ # 使用官方 action 安装最新版的 uv
22
+ - name: Install the latest version of uv
23
+ uses: astral-sh/setup-uv@v5
24
+
25
+ # 使用 uv 构建发版文件 (生成 .tar.gz 源码包和 .whl 二进制包)
26
+ - name: Build package
27
+ run: uv build
28
+
29
+ # 使用 PyPA 官方 action 发布到 PyPI
30
+ - name: Publish package distributions to PyPI
31
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,16 @@
1
+ # 缓存
2
+ cache_manifest.json
3
+ __pycache__/
4
+ *.pyc
5
+
6
+ # 环境
7
+ .env
8
+ .venv/
9
+ venv/
10
+
11
+ # IDE
12
+ .idea/
13
+ .vscode/
14
+ *.swp
15
+ *.swo
16
+ .DS_Store
@@ -0,0 +1,22 @@
1
+ # 更新日志 (Changelog)
2
+
3
+ 本项目的所有重要更改都将统一记录在此文件中。
4
+
5
+ 此文件的格式基于 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),
6
+ 并且本项目遵循 [语义化版本规范 (Semantic Versioning)](https://semver.org/spec/v2.0.0.html)。
7
+
8
+ ## [0.1.0] - 2026-02-27
9
+
10
+ 这是 `getnotes-cli` 的首次发布版本,包含以下核心功能集锦:
11
+
12
+ ### 新增 (Added)
13
+ - **核心下载功能**:实现“得到笔记”的自动下载,统一将笔记保存为易于阅读的 Markdown 格式文档,并嵌入本地化保存的附件与图片。
14
+ - **浏览器自动登录**:新增基于浏览器的登录功能,一键自动获取最新的认证请求头(Bearer tokens),无需繁杂的手动配置。
15
+ - **多维度下载命令**:
16
+ - 支持普通笔记内容的拉取与组织(`download`, `download-all`)。
17
+ - 支持笔记订阅管理,支持列出已订阅的知识库、下载特定知识库以及一次性下载所有订阅知识库的笔记内容。
18
+ - **配置持久化管理**:引入 CLI 配置模块(基于 `~/.getnotes-cli/config.json` 开发的 `settings.py`),支持对输出目录、请求延迟和单页拉取数量等参数进行个性化和持久化设置。
19
+ - **精细化控制选项**:
20
+ - 新增 `--save-json` 参数,支持显式保存技术文件(例如,JSON 格式的 API 响应源数据),默认仅保存 Markdown 和相关附件文件以精简空间。
21
+ - 新增下载限额提示机制,当遭遇接口下载限制时智能提醒用户。
22
+ - **性能优化机制**:内置深度的 API 请求和笔记处理缓存机制 (`cache_manifest.json`),避免重复拉取和处理相同笔记带来的成本损耗,并同时修复了早期开发版本里本地笔记文件夹比对不准确导致重复下载的问题。
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 HanZhang
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,242 @@
1
+ Metadata-Version: 2.4
2
+ Name: getnotes-cli
3
+ Version: 0.1.0
4
+ Summary: 得到笔记 (GetNotes) CLI 下载工具 — 自动登录、批量下载、Markdown 导出
5
+ Author: Han Zhang
6
+ License: MIT
7
+ License-File: LICENSE
8
+ Keywords: cli,download,getnotes,markdown,得到笔记
9
+ Requires-Python: >=3.10
10
+ Requires-Dist: httpx>=0.27.0
11
+ Requires-Dist: rich>=13.0.0
12
+ Requires-Dist: typer>=0.9.0
13
+ Requires-Dist: websocket-client>=1.6.0
14
+ Description-Content-Type: text/markdown
15
+
16
+ # getnotes-cli 🗂️
17
+
18
+ > Get笔记 CLI 下载工具 — 自动登录、批量下载、知识库管理、Markdown 导出、录音图片等附件下载
19
+
20
+ [![Python](https://img.shields.io/badge/Python-3.10+-blue.svg)](https://python.org)
21
+ [![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
22
+
23
+ ## ✨ 功能
24
+
25
+ - 🔐 **自动登录** — 通过 Chrome DevTools Protocol 自动获取 Bearer token,无需手动抓包
26
+ - 📥 **批量下载** — 分页拉取全部笔记,支持指定数量
27
+ - 📚 **知识库管理** — 查看、下载我的知识库与订阅知识库
28
+ - 📝 **Markdown 导出** — 每条笔记保存为 Markdown,包含元信息、标签、正文、引用内容
29
+ - 🔊 **附件下载** — 自动下载音频、图片附件,并在 Markdown 中内嵌链接
30
+ - 💾 **缓存管理** — 自动跳过已下载且未变化的笔记,支持增量更新
31
+ - 📁 **Markdown-only 模式** — 默认值保存 Markdown 和附件,不保存技术文件,可以通过选项开启
32
+ - ⚙️ **持久化配置** — 通过 `config` 命令保存常用参数,无需每次重复输入
33
+ - ⏱️ **可配置间隔** — 自定义请求间隔,避免频率限制
34
+ - 📊 **自动索引** — 自动生成笔记索引文件 `INDEX.md`
35
+
36
+ ## 📦 安装
37
+
38
+ ```bash
39
+ cd getnotes-cli
40
+ pip install -e .
41
+ ```
42
+
43
+ 安装后即可全局使用 `getnotes` 命令。
44
+
45
+ ## 🚀 使用方法
46
+
47
+ ### 登录
48
+
49
+ ```bash
50
+ # 自动浏览器登录(推荐)
51
+ # 会打开 Chrome,导航到得到笔记页面,登录后自动捕获 token
52
+ getnotes login
53
+
54
+ # 手动输入 token(跳过浏览器)
55
+ getnotes login --token "Bearer eyJhbGci..."
56
+ ```
57
+
58
+ ### 下载笔记
59
+
60
+ ```bash
61
+ # 下载前 100 条笔记(默认)
62
+ getnotes download
63
+
64
+ # 下载全部笔记
65
+ getnotes download --all
66
+
67
+ # 自定义下载数量
68
+ getnotes download --limit 50
69
+
70
+ # 保存技术文件(默认不包含 JSON 等原始数据)
71
+ getnotes download --save-json
72
+
73
+ # 指定输出目录
74
+ getnotes download --output ~/Desktop/my_notes
75
+
76
+ # 调整请求间隔(秒)
77
+ getnotes download --delay 1.0
78
+
79
+ # 自定义每页拉取数量
80
+ getnotes download --page-size 50
81
+
82
+ # 强制重新下载,忽略缓存
83
+ getnotes download --force
84
+
85
+ # 组合使用
86
+ getnotes download --all --save-json --delay 1.0
87
+
88
+ # 直接传 token 下载(一步到位,跳过登录缓存)
89
+ getnotes download --token "Bearer eyJhbGci..." --limit 20
90
+ ```
91
+
92
+ ### 知识库管理
93
+
94
+ ```bash
95
+ # 查看所有知识库
96
+ getnotes notebook list
97
+
98
+ # 按名称下载指定知识库(模糊匹配)
99
+ getnotes notebook download --name "读书笔记"
100
+
101
+ # 按 ID 下载指定知识库
102
+ getnotes notebook download --id abc123
103
+
104
+ # 下载全部知识库
105
+ getnotes notebook download-all
106
+
107
+ # 带选项下载
108
+ getnotes notebook download --name "读书" --save-json --delay 1.0
109
+ getnotes notebook download-all --force --output ~/Desktop/notebooks
110
+ ```
111
+
112
+ ### 订阅知识库
113
+
114
+ ```bash
115
+ # 查看所有已订阅的知识库
116
+ getnotes subscribe list
117
+
118
+ # 按名称下载指定订阅知识库
119
+ getnotes subscribe download --name "某知识库"
120
+
121
+ # 按 ID 下载
122
+ getnotes subscribe download --id xyz789
123
+
124
+ # 下载全部订阅知识库
125
+ getnotes subscribe download-all
126
+
127
+ # 带选项下载
128
+ getnotes subscribe download --name "某知识库" --save-json --force
129
+ getnotes subscribe download-all --delay 1.0 --output ~/Desktop/subscribed
130
+ ```
131
+
132
+ ### 缓存管理
133
+
134
+ ```bash
135
+ # 查看缓存状态
136
+ getnotes cache check
137
+
138
+ # 清除缓存
139
+ getnotes cache clear
140
+
141
+ # 跳过确认提示
142
+ getnotes cache clear --confirm
143
+ ```
144
+
145
+ ### 配置管理
146
+
147
+ 持久化常用参数,避免每次输入。参数优先级:**命令行参数 > 配置文件 > 默认值**。
148
+
149
+ ```bash
150
+ # 设置默认输出目录
151
+ getnotes config set output ~/Desktop/my_notes
152
+
153
+ # 设置默认请求间隔
154
+ getnotes config set delay 1.0
155
+
156
+ # 设置每页拉取数量
157
+ getnotes config set page-size 50
158
+
159
+ # 查看所有配置
160
+ getnotes config get
161
+
162
+ # 查看某项配置
163
+ getnotes config get output
164
+
165
+ # 清除所有配置(恢复默认值)
166
+ getnotes config reset
167
+
168
+ # 跳过确认提示
169
+ getnotes config reset --confirm
170
+ ```
171
+
172
+ ### 其他
173
+
174
+ ```bash
175
+ # 查看版本
176
+ getnotes --version
177
+
178
+ # 查看帮助
179
+ getnotes --help
180
+ getnotes download --help
181
+ getnotes notebook --help
182
+ getnotes subscribe --help
183
+ getnotes config --help
184
+ ```
185
+
186
+ ## 📁 输出目录结构
187
+
188
+ 默认输出到 `~/Downloads/getnotes_export/`:
189
+
190
+ ```
191
+ getnotes_export/
192
+ ├── INDEX.md # 笔记索引
193
+ ├── api_responses/ # 原始 API 响应 JSON
194
+ │ ├── page_0001.json
195
+ │ └── ...
196
+ ├── notes/ # 个人笔记
197
+ │ ├── 20260226_224958_发芽报告/
198
+ │ │ ├── note.md # Markdown 笔记
199
+ │ │ ├── note.json # 原始 JSON 数据
200
+ │ │ └── attachments/ # 附件(按需创建)
201
+ │ │ ├── attachment_1.mp3
202
+ │ │ └── image_1.jpg
203
+ │ └── ...
204
+ └── notebooks/ # 知识库笔记(包含我的知识库和订阅知识库)
205
+ ├── 读书笔记/ # 按知识库名称分目录
206
+ │ ├── INDEX.md
207
+ │ ├── 20260226_笔记标题/
208
+ │ │ └── note.md
209
+ │ └── ...
210
+ └── 某订阅知识库/
211
+ ├── INDEX.md
212
+ └── ...
213
+ ```
214
+
215
+ > 默认不会创建 `api_responses/` 目录和 `note.json` 文件。使用 `--save-json` 选项时才会保存这些技术文件。
216
+
217
+ ## 🔐 Token 管理
218
+
219
+ - Token 通过 CDP(Chrome DevTools Protocol)自动获取
220
+ - 缓存在 `~/.getnotes-cli/auth.json`
221
+ - 得到 Token 约 30 分钟有效,过期后自动提示重新登录
222
+ - 也支持 `--token` 参数手动传入
223
+
224
+ ## ⚙️ 配置文件
225
+
226
+ 用户配置保存在 `~/.getnotes-cli/config.json`,支持以下配置项:
227
+
228
+ | 配置项 | 类型 | 默认值 | 说明 |
229
+ |--------|------|--------|------|
230
+ | `output` | string | `~/Downloads/getnotes_export` | 默认输出目录 |
231
+ | `delay` | float | `0.5` | 请求间隔(秒) |
232
+ | `page-size` | int | `20` | 每页拉取数量 |
233
+
234
+ *注:缓存清单文件 `cache_manifest.json` 也会统一保存在此目录。*
235
+
236
+ ## ⚠️ 注意事项
237
+
238
+ - 首次使用请先运行 `getnotes login` 登录
239
+ - 附件 URL 中的签名有过期时间,建议一次性下载完成
240
+ - 已下载的附件不会重复下载(自动跳过)
241
+ - 默认下载前 100 条用于调试,确认无误后使用 `--all` 下载全部
242
+ - 知识库下载按知识库名称创建子目录,统一保存在 `notebooks/` 下
@@ -0,0 +1,227 @@
1
+ # getnotes-cli 🗂️
2
+
3
+ > Get笔记 CLI 下载工具 — 自动登录、批量下载、知识库管理、Markdown 导出、录音图片等附件下载
4
+
5
+ [![Python](https://img.shields.io/badge/Python-3.10+-blue.svg)](https://python.org)
6
+ [![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
7
+
8
+ ## ✨ 功能
9
+
10
+ - 🔐 **自动登录** — 通过 Chrome DevTools Protocol 自动获取 Bearer token,无需手动抓包
11
+ - 📥 **批量下载** — 分页拉取全部笔记,支持指定数量
12
+ - 📚 **知识库管理** — 查看、下载我的知识库与订阅知识库
13
+ - 📝 **Markdown 导出** — 每条笔记保存为 Markdown,包含元信息、标签、正文、引用内容
14
+ - 🔊 **附件下载** — 自动下载音频、图片附件,并在 Markdown 中内嵌链接
15
+ - 💾 **缓存管理** — 自动跳过已下载且未变化的笔记,支持增量更新
16
+ - 📁 **Markdown-only 模式** — 默认值保存 Markdown 和附件,不保存技术文件,可以通过选项开启
17
+ - ⚙️ **持久化配置** — 通过 `config` 命令保存常用参数,无需每次重复输入
18
+ - ⏱️ **可配置间隔** — 自定义请求间隔,避免频率限制
19
+ - 📊 **自动索引** — 自动生成笔记索引文件 `INDEX.md`
20
+
21
+ ## 📦 安装
22
+
23
+ ```bash
24
+ cd getnotes-cli
25
+ pip install -e .
26
+ ```
27
+
28
+ 安装后即可全局使用 `getnotes` 命令。
29
+
30
+ ## 🚀 使用方法
31
+
32
+ ### 登录
33
+
34
+ ```bash
35
+ # 自动浏览器登录(推荐)
36
+ # 会打开 Chrome,导航到得到笔记页面,登录后自动捕获 token
37
+ getnotes login
38
+
39
+ # 手动输入 token(跳过浏览器)
40
+ getnotes login --token "Bearer eyJhbGci..."
41
+ ```
42
+
43
+ ### 下载笔记
44
+
45
+ ```bash
46
+ # 下载前 100 条笔记(默认)
47
+ getnotes download
48
+
49
+ # 下载全部笔记
50
+ getnotes download --all
51
+
52
+ # 自定义下载数量
53
+ getnotes download --limit 50
54
+
55
+ # 保存技术文件(默认不包含 JSON 等原始数据)
56
+ getnotes download --save-json
57
+
58
+ # 指定输出目录
59
+ getnotes download --output ~/Desktop/my_notes
60
+
61
+ # 调整请求间隔(秒)
62
+ getnotes download --delay 1.0
63
+
64
+ # 自定义每页拉取数量
65
+ getnotes download --page-size 50
66
+
67
+ # 强制重新下载,忽略缓存
68
+ getnotes download --force
69
+
70
+ # 组合使用
71
+ getnotes download --all --save-json --delay 1.0
72
+
73
+ # 直接传 token 下载(一步到位,跳过登录缓存)
74
+ getnotes download --token "Bearer eyJhbGci..." --limit 20
75
+ ```
76
+
77
+ ### 知识库管理
78
+
79
+ ```bash
80
+ # 查看所有知识库
81
+ getnotes notebook list
82
+
83
+ # 按名称下载指定知识库(模糊匹配)
84
+ getnotes notebook download --name "读书笔记"
85
+
86
+ # 按 ID 下载指定知识库
87
+ getnotes notebook download --id abc123
88
+
89
+ # 下载全部知识库
90
+ getnotes notebook download-all
91
+
92
+ # 带选项下载
93
+ getnotes notebook download --name "读书" --save-json --delay 1.0
94
+ getnotes notebook download-all --force --output ~/Desktop/notebooks
95
+ ```
96
+
97
+ ### 订阅知识库
98
+
99
+ ```bash
100
+ # 查看所有已订阅的知识库
101
+ getnotes subscribe list
102
+
103
+ # 按名称下载指定订阅知识库
104
+ getnotes subscribe download --name "某知识库"
105
+
106
+ # 按 ID 下载
107
+ getnotes subscribe download --id xyz789
108
+
109
+ # 下载全部订阅知识库
110
+ getnotes subscribe download-all
111
+
112
+ # 带选项下载
113
+ getnotes subscribe download --name "某知识库" --save-json --force
114
+ getnotes subscribe download-all --delay 1.0 --output ~/Desktop/subscribed
115
+ ```
116
+
117
+ ### 缓存管理
118
+
119
+ ```bash
120
+ # 查看缓存状态
121
+ getnotes cache check
122
+
123
+ # 清除缓存
124
+ getnotes cache clear
125
+
126
+ # 跳过确认提示
127
+ getnotes cache clear --confirm
128
+ ```
129
+
130
+ ### 配置管理
131
+
132
+ 持久化常用参数,避免每次输入。参数优先级:**命令行参数 > 配置文件 > 默认值**。
133
+
134
+ ```bash
135
+ # 设置默认输出目录
136
+ getnotes config set output ~/Desktop/my_notes
137
+
138
+ # 设置默认请求间隔
139
+ getnotes config set delay 1.0
140
+
141
+ # 设置每页拉取数量
142
+ getnotes config set page-size 50
143
+
144
+ # 查看所有配置
145
+ getnotes config get
146
+
147
+ # 查看某项配置
148
+ getnotes config get output
149
+
150
+ # 清除所有配置(恢复默认值)
151
+ getnotes config reset
152
+
153
+ # 跳过确认提示
154
+ getnotes config reset --confirm
155
+ ```
156
+
157
+ ### 其他
158
+
159
+ ```bash
160
+ # 查看版本
161
+ getnotes --version
162
+
163
+ # 查看帮助
164
+ getnotes --help
165
+ getnotes download --help
166
+ getnotes notebook --help
167
+ getnotes subscribe --help
168
+ getnotes config --help
169
+ ```
170
+
171
+ ## 📁 输出目录结构
172
+
173
+ 默认输出到 `~/Downloads/getnotes_export/`:
174
+
175
+ ```
176
+ getnotes_export/
177
+ ├── INDEX.md # 笔记索引
178
+ ├── api_responses/ # 原始 API 响应 JSON
179
+ │ ├── page_0001.json
180
+ │ └── ...
181
+ ├── notes/ # 个人笔记
182
+ │ ├── 20260226_224958_发芽报告/
183
+ │ │ ├── note.md # Markdown 笔记
184
+ │ │ ├── note.json # 原始 JSON 数据
185
+ │ │ └── attachments/ # 附件(按需创建)
186
+ │ │ ├── attachment_1.mp3
187
+ │ │ └── image_1.jpg
188
+ │ └── ...
189
+ └── notebooks/ # 知识库笔记(包含我的知识库和订阅知识库)
190
+ ├── 读书笔记/ # 按知识库名称分目录
191
+ │ ├── INDEX.md
192
+ │ ├── 20260226_笔记标题/
193
+ │ │ └── note.md
194
+ │ └── ...
195
+ └── 某订阅知识库/
196
+ ├── INDEX.md
197
+ └── ...
198
+ ```
199
+
200
+ > 默认不会创建 `api_responses/` 目录和 `note.json` 文件。使用 `--save-json` 选项时才会保存这些技术文件。
201
+
202
+ ## 🔐 Token 管理
203
+
204
+ - Token 通过 CDP(Chrome DevTools Protocol)自动获取
205
+ - 缓存在 `~/.getnotes-cli/auth.json`
206
+ - 得到 Token 约 30 分钟有效,过期后自动提示重新登录
207
+ - 也支持 `--token` 参数手动传入
208
+
209
+ ## ⚙️ 配置文件
210
+
211
+ 用户配置保存在 `~/.getnotes-cli/config.json`,支持以下配置项:
212
+
213
+ | 配置项 | 类型 | 默认值 | 说明 |
214
+ |--------|------|--------|------|
215
+ | `output` | string | `~/Downloads/getnotes_export` | 默认输出目录 |
216
+ | `delay` | float | `0.5` | 请求间隔(秒) |
217
+ | `page-size` | int | `20` | 每页拉取数量 |
218
+
219
+ *注:缓存清单文件 `cache_manifest.json` 也会统一保存在此目录。*
220
+
221
+ ## ⚠️ 注意事项
222
+
223
+ - 首次使用请先运行 `getnotes login` 登录
224
+ - 附件 URL 中的签名有过期时间,建议一次性下载完成
225
+ - 已下载的附件不会重复下载(自动跳过)
226
+ - 默认下载前 100 条用于调试,确认无误后使用 `--all` 下载全部
227
+ - 知识库下载按知识库名称创建子目录,统一保存在 `notebooks/` 下
@@ -0,0 +1,28 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "getnotes-cli"
7
+ version = "0.1.0"
8
+ description = "得到笔记 (GetNotes) CLI 下载工具 — 自动登录、批量下载、Markdown 导出"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ requires-python = ">=3.10"
12
+ authors = [
13
+ { name = "Han Zhang" }
14
+ ]
15
+ keywords = ["getnotes", "得到笔记", "cli", "download", "markdown"]
16
+
17
+ dependencies = [
18
+ "typer>=0.9.0",
19
+ "rich>=13.0.0",
20
+ "httpx>=0.27.0",
21
+ "websocket-client>=1.6.0",
22
+ ]
23
+
24
+ [project.scripts]
25
+ getnotes = "getnotes_cli.cli:main"
26
+
27
+ [tool.hatch.build.targets.wheel]
28
+ packages = ["src/getnotes_cli"]
@@ -0,0 +1,3 @@
1
+ """getnotes-cli — 得到笔记 CLI 下载工具"""
2
+
3
+ __version__ = "0.1.0"