Skip to main content

Get 笔记 CLI 下载工具 — 自动登录、批量下载、Markdown 导出

Project description

getnotes-cli 🗂️

Get笔记 CLI 下载工具 — 自动登录、批量下载、知识库管理、Markdown 导出、录音图片等附件下载、MCP 服务器集成

初衷与设计理念:

  • 📦 数据自有化:将你在平台积攒的笔记、知识库等数字资产完整下载到本地,实现数据的真正自有化与安全备份。
  • 🤖 Agent 工作流:提供标准化的 CLI 和本地文件系统接口,便于无缝嵌入到各类大模型 Agent 或自动化流程中,充当高质量的个人知识上下文。

Python License

✨ 功能

  • 🔐 自动登录 — 通过 Chrome DevTools Protocol 自动获取 Bearer token,无需手动抓包
  • 📥 批量下载 — 分页拉取全部笔记,支持指定数量
  • 📤 新建笔记 — 支持通过本地 Markdown 或文本文件创建笔记,并支持自动上传内嵌图片
  • 📚 知识库管理 — 查看、下载我的知识库与订阅知识库
  • 📝 Markdown 导出 — 每条笔记保存为 Markdown,包含元信息、标签、正文、引用内容
  • 🔊 附件下载 — 自动下载音频、图片附件,并在 Markdown 中内嵌链接
  • 💾 缓存管理 — 自动跳过已下载且未变化的笔记,支持增量更新
  • 📁 Markdown-only 模式 — 默认值保存 Markdown 和附件,不保存技术文件,可以通过选项开启
  • ⚙️ 持久化配置 — 通过 config 命令保存常用参数,无需每次重复输入
  • ⏱️ 可配置间隔 — 自定义请求间隔,避免频率限制
  • 📊 自动索引 — 自动生成笔记索引文件 INDEX.md

🤖 MCP 服务器

Get笔记 CLI 提供原生的 Model Context Protocol (MCP) 服务器支持,允许集成 Claude Desktop 等 AI 客户端直接为你管理笔记和知识库。

配置 Claude Desktop

编辑 Claude Desktop 配置文件 claude_desktop_config.json(通常在 ~/Library/Application Support/Claude/):

{
  "mcpServers": {
    "getnotes": {
      "command": "uvx",
      "args": [
        "--from",
        "getnotes-cli",
        "getnotes-mcp"
      ]
    }
  }
}

注意:在使用 MCP 服务器前,确保你在终端执行过 getnotes login 获取了 Token。

可用 MCP Tools

  • download_notes(limit=10): 下载近期笔记为 Markdown 文件。
  • create_note(content): 直接提交文本建立新笔记。
  • create_link_note(url): 通过 AI 解析链接创建深度笔记。
  • list_notebooks(): 获取你创建的知识库列表及对应 ID。
  • download_notebook(notebook_id): 下载指定的知识库内容。
  • list_subscribed_notebooks(): 获取订阅知识库列表。
  • download_subscribed_notebook(notebook_id): 下载指定的订阅知识库。

📦 Cli 安装

使用 uv 安装(推荐)

uv tool install getnotes-cli

使用 pip 安装

pip install getnotes-cli

源码安装(本地开发)

cd getnotes-cli
pip install -e .

安装后即可全局使用 getnotes 命令。

🚀 使用方法

登录

# 自动浏览器登录(推荐)
# 会打开 Chrome,导航到得到笔记页面,登录后自动捕获 token
getnotes login

# 手动输入 token(跳过浏览器)
getnotes login --token "Bearer eyJhbGci..."

新建笔记

# 从本地 Markdown 或文本文件创建得到笔记
getnotes create --file my_note.md

# 创建笔记并附带一张图片(图片将自动上传并追加到正文末尾)
getnotes create -f my_note.md --image cover.jpg

# 创建笔记并附带多张图片(多次指定 -i 或 --image 选项)
getnotes create -f my_note.md -i img1.png -i img2.jpg

# 通过链接创建笔记(AI 自动分析并生成深度笔记)
getnotes create-link <url>

下载笔记

# 下载前 100 条笔记(默认)
getnotes download

# 下载全部笔记
getnotes download --all

# 自定义下载数量
getnotes download --limit 50

# 保存技术文件(默认不包含 JSON 等原始数据)
getnotes download --save-json

# 指定输出目录
getnotes download --output ~/Desktop/my_notes

# 调整请求间隔(秒)
getnotes download --delay 1.0

# 自定义每页拉取数量
getnotes download --page-size 50

# 强制重新下载,忽略缓存
getnotes download --force

# 组合使用
getnotes download --all --save-json --delay 1.0

# 直接传 token 下载(一步到位,跳过登录缓存)
getnotes download --token "Bearer eyJhbGci..." --limit 20

知识库管理

# 查看所有知识库
getnotes notebook list

# 按名称下载指定知识库(模糊匹配)
getnotes notebook download --name "读书笔记"

# 按 ID 下载指定知识库
getnotes notebook download --id abc123

# 下载全部知识库
getnotes notebook download-all

# 带选项下载
getnotes notebook download --name "读书" --save-json --delay 1.0
getnotes notebook download-all --force --output ~/Desktop/notebooks

订阅知识库

# 查看所有已订阅的知识库
getnotes subscribe list

# 按名称下载指定订阅知识库
getnotes subscribe download --name "某知识库"

# 按 ID 下载
getnotes subscribe download --id xyz789

# 下载全部订阅知识库
getnotes subscribe download-all

# 带选项下载
getnotes subscribe download --name "某知识库" --save-json --force
getnotes subscribe download-all --delay 1.0 --output ~/Desktop/subscribed

缓存管理

# 查看缓存状态
getnotes cache check

# 清除缓存
getnotes cache clear

# 跳过确认提示
getnotes cache clear --confirm

配置管理

持久化常用参数,避免每次输入。参数优先级:命令行参数 > 配置文件 > 默认值

# 设置默认输出目录
getnotes config set output ~/Desktop/my_notes

# 设置默认请求间隔
getnotes config set delay 1.0

# 设置每页拉取数量
getnotes config set page-size 50

# 查看所有配置
getnotes config get

# 查看某项配置
getnotes config get output

# 清除所有配置(恢复默认值)
getnotes config reset

# 跳过确认提示
getnotes config reset --confirm

其他

# 查看版本
getnotes --version

# 查看帮助
getnotes --help
getnotes create --help
getnotes download --help
getnotes notebook --help
getnotes subscribe --help
getnotes config --help

📁 输出目录结构

默认输出到 ~/Downloads/getnotes_export/

getnotes_export/
├── INDEX.md                          # 笔记索引
├── api_responses/                    # 原始 API 响应 JSON
│   ├── page_0001.json
│   └── ...
├── notes/                            # 个人笔记
│   ├── 20260226_224958_发芽报告/
│   │   ├── note.md                   # Markdown 笔记
│   │   ├── note.json                 # 原始 JSON 数据
│   │   └── attachments/              # 附件(按需创建)
│   │       ├── attachment_1.mp3
│   │       └── image_1.jpg
│   └── ...
└── notebooks/                        # 知识库笔记(包含我的知识库和订阅知识库)
    ├── 读书笔记/                      # 按知识库名称分目录
    │   ├── INDEX.md
    │   ├── 20260226_笔记标题/
    │   │   └── note.md
    │   └── ...
    └── 某订阅知识库/
        ├── INDEX.md
        └── ...

默认不会创建 api_responses/ 目录和 note.json 文件。使用 --save-json 选项时才会保存这些技术文件。

🔐 Token 管理

  • Token 通过 CDP(Chrome DevTools Protocol)自动获取
  • 缓存在 ~/.getnotes-cli/auth.json
  • 得到 Token 约 30 分钟有效,过期后自动提示重新登录
  • 也支持 --token 参数手动传入

⚙️ 配置文件

用户配置保存在 ~/.getnotes-cli/config.json,支持以下配置项:

配置项 类型 默认值 说明
output string ~/Downloads/getnotes_export 默认输出目录
delay float 0.5 请求间隔(秒)
page-size int 20 每页拉取数量

注:缓存清单文件 cache_manifest.json 也会统一保存在此目录。

⚠️ 注意事项

  • 首次使用请先运行 getnotes login 登录
  • 附件 URL 中的签名有过期时间,建议一次性下载完成
  • 已下载的附件不会重复下载(自动跳过)
  • 默认下载前 100 条用于调试,确认无误后使用 --all 下载全部
  • 知识库下载按知识库名称创建子目录,统一保存在 notebooks/

🙏 致谢

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

getnotes_cli-0.1.4.tar.gz (125.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

getnotes_cli-0.1.4-py3-none-any.whl (44.0 kB view details)

Uploaded Python 3

File details

Details for the file getnotes_cli-0.1.4.tar.gz.

File metadata

  • Download URL: getnotes_cli-0.1.4.tar.gz
  • Upload date:
  • Size: 125.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for getnotes_cli-0.1.4.tar.gz
Algorithm Hash digest
SHA256 1caf5adeef32d7a8b21182d39efe7ea7f591f08899dcbaf382bfcd4ef936d8a3
MD5 7d2145cbcff5a14e6eb0fb36ef8b38d0
BLAKE2b-256 946c68c6d18bc5b53418038606b48ac34cb9f44323da0265b919501911990b04

See more details on using hashes here.

Provenance

The following attestation bundles were made for getnotes_cli-0.1.4.tar.gz:

Publisher: publish.yml on QinGeneral/getnotes-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file getnotes_cli-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: getnotes_cli-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 44.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for getnotes_cli-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 90031471ae26973c9405d41937841cf4f6933054c59d63006222e33c0a2f0ef8
MD5 0cf9385de12a7f80e52773f959bf44c3
BLAKE2b-256 2484815ab9ae2a7431f0b43275c020807bf0a82922405b38b0aa4e571e17c68f

See more details on using hashes here.

Provenance

The following attestation bundles were made for getnotes_cli-0.1.4-py3-none-any.whl:

Publisher: publish.yml on QinGeneral/getnotes-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page