redbeacon — 小红书自动化 CLI
把"选好题"以外的事全部交给 CLI:AI 生成文案 + 渲图 / 出图 → 审核 → 多账号发布 → 排期 → 选题库管理。所有命令都是 JSON in / JSON out,方便接入任何 agent、脚本、CI。
主要被 redbeacon-skill(Claude Code skill 封装)调用,但完全可以独立用。
安装
# 推荐:pipx 隔离环境
pipx install redbeacon
# 或者直接 pip
pip install redbeacon
# Playwright 渲图引擎(图文卡片用)
playwright install chromium
# 校验
redbeacon --version
CloakBrowser 的 stealth Chromium 在首次跑
redbeacon login start时自动下载到~/.cloakbrowser/(约 200MB),不用手动装。
依赖:Python ≥ 3.11。
30 秒看懂
redbeacon readiness # 入口:看现在缺什么配
redbeacon config set ai_api_key sk-… # 配 AI Key
redbeacon accounts create # 建第 1 个小红书账号(id=1)
redbeacon login start --account-id 1 # 阻塞 + 弹浏览器扫码
redbeacon generate --account-id 1 --image-mode cards # 生成一篇
redbeacon content list --account-id 1 --status pending_review
redbeacon content approve --account-id 1 --id 1 # 本地审核
redbeacon publish --account-id 1 # 发布
每个命令成功 → exit 0 + stdout 一行 JSON;失败 → exit ≠0 + stderr {"error", "next"}。
命令总览
| 子命令 | 说明 |
|---|---|
redbeacon readiness |
配置完整度 + 引导下一步 |
redbeacon status |
账号 / 内容计数 / 路径总览 |
redbeacon accounts <list|get|create|delete|patch> |
账号 CRUD |
redbeacon login <start|verify|status|delete> |
小红书登录(CloakBrowser) |
redbeacon config <list|get|set|models|test-ai|test-feishu|feishu-users> |
配置管理 |
redbeacon strategy <get|patch> |
账号定位 / 调性 / 提示词 |
redbeacon topics <list|add|batch|inspire|stats|reset|types|types-init> |
选题库 |
redbeacon content <list|get|approve|reject|edit|feishu-push> |
内容审核 |
redbeacon generate --account-id N [--topic …] [--image-mode cards|ai|both] |
AI 生成(阻塞) |
redbeacon publish --account-id N |
发布(飞书源 / 本地源自动判断,阻塞) |
redbeacon feishu <sync|setup|test> |
飞书多维表格 |
redbeacon logs [--tail 150] |
看日志 |
redbeacon --help / redbeacon <子命令> --help 看完整参数。
数据位置
| 路径 | 内容 |
|---|---|
~/.redbeacon/data/redbeacon.db |
SQLite 主库 |
~/.redbeacon/data/cb_profiles/{id}/ |
每账号 CloakBrowser profile(含 cookie) |
~/.redbeacon/data/images/ |
生成的图片 |
~/.redbeacon/logs/redbeacon.log |
运行日志 |
~/.cloakbrowser/chromium-*/ |
stealth Chromium |
环境变量覆盖:REDBEACON_DATA_DIR / REDBEACON_LOG_DIR。
跑 redbeacon status 看当前实际路径。
输出契约
- 默认:
{"key": "value", ...}一行 JSON - TTY 下自动 indent=2 可读;强制覆盖:
REDBEACON_OUT=pretty/REDBEACON_OUT=compact - 错误:stderr
{"error": "...", "next": "redbeacon <修复命令>"}
完整 schema 定义在 src/redbeacon/schemas.py(TypedDict)。
开发
git clone https://github.com/jidouqie/redbeacon-cli.git
cd redbeacon-cli
pip install -e .[dev]
# 测试
pytest tests/
# 本地跑
redbeacon --version
REDBEACON_DATA_DIR=/tmp/rb_dev redbeacon readiness
代码结构:
src/redbeacon/
├── cli.py # argparse 入口 + dispatch
├── config.py # settings 表读写(加密支持)
├── config_keys.py # 所有 settings key 集中定义
├── database.py # SQLite 初始化 + migrate
├── schemas.py # 输出 TypedDict
├── render_xhs_v2.py # 图文卡片渲染(Playwright)
├── routers/ # 子命令处理(accounts / login / config / publish ...)
├── services/
│ ├── xhs/ # CloakBrowser 集成(session/login/publish)
│ ├── feishu_api.py
│ ├── image_gen.py
│ └── proxy_service.py
├── tasks/ # 复杂业务编排(generate / publish / feishu_sync)
└── utils/ # logger / crypto / paths
加新命令:在 routers/ 下加文件 + 在 cli.py:_build_parser 和 _DISPATCH 注册即可。
License
MIT。详见 LICENSE。
Metadata
Release files for redbeacon 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| redbeacon-0.1.0.tar.gz | 74.0 kB | Without provenance | Details for redbeacon-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| redbeacon-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for redbeacon-0.1.0-py3-none-any.whl |
Total release size: 159.8 kB
Release files / redbeacon-0.1.0.tar.gz
| Download URL | redbeacon-0.1.0.tar.gz |
|---|---|
| Size | 74.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60f4668c91c196f8227f1219d7699cd49ea6bddb8454f277a3086fc4cf9047c8
|
|
BLAKE2b-256 checksum How to use checksums |
0ad4b0c57fd75346ad77a1d78ea56234e7611b0bc4b9a8e6f6e7496201ea04fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Release files / redbeacon-0.1.0-py3-none-any.whl
| Download URL | redbeacon-0.1.0-py3-none-any.whl |
|---|---|
| Size | 85.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0117005c37e22cfdb05eed667add65fd0457dc90a74df5979a246a0833e1cc3a
|
|
BLAKE2b-256 checksum How to use checksums |
80fb066edc43c4cf76fb1324c825e7d8669b1280644bcf9557cfb7089377886e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Security for redbeacon 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.