RedBeacon — 小红书自动化 CLI(生成 / 审核 / 发布 / 多账号)
Project description
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。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file redbeacon-0.1.0.tar.gz.
File metadata
- Download URL: redbeacon-0.1.0.tar.gz
- Upload date:
- Size: 74.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60f4668c91c196f8227f1219d7699cd49ea6bddb8454f277a3086fc4cf9047c8
|
|
| MD5 |
509c37cd3f3b00c64c02c35f31096c89
|
|
| BLAKE2b-256 |
0ad4b0c57fd75346ad77a1d78ea56234e7611b0bc4b9a8e6f6e7496201ea04fd
|
File details
Details for the file redbeacon-0.1.0-py3-none-any.whl.
File metadata
- Download URL: redbeacon-0.1.0-py3-none-any.whl
- Upload date:
- Size: 85.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0117005c37e22cfdb05eed667add65fd0457dc90a74df5979a246a0833e1cc3a
|
|
| MD5 |
d2f145cd6f23c2b7fad7a0a018367d80
|
|
| BLAKE2b-256 |
80fb066edc43c4cf76fb1324c825e7d8669b1280644bcf9557cfb7089377886e
|