Skip to main content

rednote-cli

Rednote 平台专用 CLI(独立安装、独立升级、独立发布)。

系统要求

  • Python 3.12.x
  • pipx

安装

brew update
brew upgrade python@3.12 pipx
python3.12 --version
pipx --version
pipx ensurepath
exec zsh

pipx install --python python3.12 rednote-cli

升级

pipx upgrade --python python3.12 rednote-cli

如果历史环境用了其他 Python(例如 3.14),先重建:

pipx reinstall --python python3.12 rednote-cli

卸载

pipx uninstall rednote-cli

快速开始

rednote-cli init runtime
rednote-cli doctor run --format json
rednote-cli account login
rednote-cli account status --format json
rednote-cli search note --keyword 旅行 --size 10 --sort-by latest --note-type image_text --format json

常用命令

rednote-cli search note --keyword <kw> [--size N] [--sort-by <comprehensive|latest|most_liked|most_commented|most_favorited>] [--note-type <all|video|image_text>] [--publish-time <all|day|week|half_year>] [--search-scope <all|viewed|unviewed|following>] [--location <all|local|nearby>] [--account <user_id>] [--input <file|->]

rednote-cli note --note-id <id> [--xsec-token t] [--xsec-source src] [--comment-size N] [--sub-comment-size N] [--account <user_id>] [--input <file|->]
  # 如上游已拿到 xsec_token,默认优先携带;发现页里的笔记=pc_feed,搜索页里的笔记=pc_search,达人收藏页里的笔记=pc_collect,达人点赞页里的笔记=pc_like,达人笔记页里的笔记=pc_user

rednote-cli search user --keyword <kw> [--size N] [--account <user_id>] [--input <file|->]

rednote-cli user --user-id <id> [--xsec-token t] [--xsec-source src] [--account <user_id>] [--input <file|->]
  # 如上游已拿到 xsec_token,默认优先携带;发现页里的达人=pc_feed,搜索页里的达人=pc_search,达人收藏页里的达人=pc_collect,达人点赞页里的达人=pc_like,笔记页里的达人=pc_note

rednote-cli user self --account <user_id>

rednote-cli publish --target image --account <account_uid> [--image-list csv] [--title t] [--content c] [--tags csv] [--schedule-at rfc3339] [--input <file|->]
rednote-cli publish --target video --account <account_uid> [--video <path-or-url>] [--title t] [--content c] [--tags csv] [--schedule-at rfc3339] [--input <file|->]

JSON 输入模式(--input)

参数优先级固定:

  • 显式 CLI 参数 > --input JSON > 默认值

支持 --input 的命令:

  • search note
  • search user
  • note
  • user
  • publish

note 的 --input 里如果带 xsec_source,它表示笔记来源:发现页笔记=pc_feed,搜索页笔记=pc_search,达人收藏页笔记=pc_collect,达人点赞页笔记=pc_like,达人笔记页笔记=pc_user。

user 的 --input 里如果带 xsec_source,它表示达人来源:发现页达人=pc_feed,搜索页达人=pc_search,达人收藏页达人=pc_collect,达人点赞页达人=pc_like,笔记页达人=pc_note。

不支持 --input 的命令:

  • init runtime
  • doctor run
  • account login|status|list|activate|deactivate|delete
  • user self

推荐 Agent 调用模板:

rednote-cli --format json --trace-id req-001 search note --input payload.json
cat payload.json | rednote-cli --format json --trace-id req-002 publish --input - --account user_001

输出与退出码

  • 建议自动化调用统一使用 --format json + --trace-id
  • 退出码:0 成功,2 参数错误,3 认证错误,4 风控/限流,5 内部错误,6 超时,7 依赖缺失/未实现

工作区文档

  • Workspace 总览:../../README.md

Metadata

Release files for rednote-cli 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rednote-cli 0.1.8
File Size Uploaded
rednote_cli-0.1.8.tar.gz 59.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rednote-cli 0.1.8
File Interpreter ABI Platform
rednote_cli-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 141.0 kB

Release files / rednote_cli-0.1.8.tar.gz

Download URL rednote_cli-0.1.8.tar.gz
Size 59.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ecbed9d19260f1dd21e60431aa87f9864686759a61df18bfffdb4968e0622228
BLAKE2b-256 checksum
How to use checksums
23192db27c83eb917582c16304c2793c4435fa1d801179b9424ad46bf291b667
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 1, 2026.

Transparency log

Release files / rednote_cli-0.1.8-py3-none-any.whl

Download URL rednote_cli-0.1.8-py3-none-any.whl
Size 81.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8d912f76f5f5f310f565cf23a479dc145845cc1f8fffd3639be3db0469a838ca
BLAKE2b-256 checksum
How to use checksums
a2f080e719f1e1e9edfa805e65795b8f925982686db428c6dadd403e4c288df5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page