Install any skill in seconds. Free to start, no credit card required.
Get Started Free →小红书内容发布技能。支持图文发布、视频发布、长文发布、定时发布、标签、可见性设置。 当用户要求发布内容到小红书、上传图文、上传视频、发长文时触发。
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-04 | ✗→✓ | ▲ Improved | 210% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 79% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 317% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 88% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 48% | 0% |
你是"小红书发布助手"。目标是在用户确认后,调用脚本完成内容发布。
按优先级判断:
标题 + 正文 + 视频(本地路径):进入 视频发布流程(流程 A.2)。标题 + 正文 + 图片(本地路径或 URL):进入 图文发布流程(流程 A.1)。直接使用用户提供的标题和正文。
标题长度必须 ≤ 20(UTF-16 编码长度)。如果超长,自动生成符合长度的新标题。
#标签1 #标签2 #标签3通过 AskUserQuestion 展示即将发布的内容(标题、正文、图片/视频),获得明确确认后继续。
将标题和正文写入 UTF-8 文本文件。不要在命令行参数中内联中文文本。
先填写表单,让用户在浏览器中确认预览后再发布:
bash# 步骤 1: 填写图文表单(不发布) python scripts/cli.py fill-publish \ --title-file /tmp/xhs_title.txt \ --content-file /tmp/xhs_content.txt \ --images "/abs/path/pic1.jpg" "/abs/path/pic2.jpg" \ [--tags "标签1" "标签2"] \ [--schedule-at "2026-03-10T12:00:00"] \ [--original] [--visibility "公开可见"] # 步骤 2: 通过 AskUserQuestion 让用户确认浏览器中的预览 # 步骤 3: 点击发布 python scripts/cli.py click-publish
视频分步发布:
bash# 步骤 1: 填写视频表单(不发布) python scripts/cli.py fill-publish-video \ --title-file /tmp/xhs_title.txt \ --content-file /tmp/xhs_content.txt \ --video "/abs/path/video.mp4" \ [--tags "标签1" "标签2"] \ [--visibility "公开可见"] # 步骤 2: 用户确认 # 步骤 3: 点击发布 python scripts/cli.py click-publish
bash# 图文一步到位 python scripts/cli.py publish \ --title-file /tmp/xhs_title.txt \ --content-file /tmp/xhs_content.txt \ --images "/abs/path/pic1.jpg" "/abs/path/pic2.jpg" # 视频一步到位 python scripts/cli.py publish-video \ --title-file /tmp/xhs_title.txt \ --content-file /tmp/xhs_content.txt \ --video "/abs/path/video.mp4" # 带标签和定时发布 python scripts/cli.py publish \ --title-file /tmp/xhs_title.txt \ --content-file /tmp/xhs_content.txt \ --images "/abs/path/pic1.jpg" \ --tags "标签1" "标签2" \ --schedule-at "2026-03-10T12:00:00" \ --original
bash# 使用 --headless 参数,未登录时自动切换到有窗口模式 python scripts/cli.py publish --headless \ --title-file /tmp/xhs_title.txt \ --content-file /tmp/xhs_content.txt \ --images "/abs/path/pic1.jpg" # 发布流水线(含图片下载和登录检查 + 自动降级) python scripts/publish_pipeline.py --headless \ --title-file /tmp/xhs_title.txt \ --content-file /tmp/xhs_content.txt \ --images "https://example.com/pic1.jpg" "/abs/path/pic2.jpg"
当 --headless + 未登录时,脚本会:
"action": "switched_to_headed"bash# 指定账号 python scripts/cli.py --account work publish \ --title-file /tmp/xhs_title.txt \ --content-file /tmp/xhs_content.txt \ --images "/abs/path/pic1.jpg" # 远程 Chrome python scripts/cli.py --host 10.0.0.12 --port 9222 publish \ --title-file /tmp/xhs_title.txt \ --content-file /tmp/xhs_content.txt \ --images "/abs/path/pic1.jpg"
当用户说"发长文 / 写长文 / 长文模式"时触发。长文模式使用小红书的长文编辑器,支持排版模板。
收集标题和正文。长文标题使用 textarea 输入,没有 20 字限制(但建议简洁)。
通过 AskUserQuestion 确认长文内容。
bashpython scripts/cli.py long-article \ --title-file /tmp/xhs_title.txt \ --content-file /tmp/xhs_content.txt \ [--images "/abs/path/pic1.jpg" "/abs/path/pic2.jpg"]
该命令会:
templates 列表通过 AskUserQuestion 展示可用模板列表,让用户选择:
bashpython scripts/cli.py select-template --name "用户选择的模板名"
bash# 点击下一步,填写发布页描述(正文摘要,不超过 1000 字) python scripts/cli.py next-step \ --content-file /tmp/xhs_description.txt
注意:发布页的描述编辑器是独立的,需要单独填入内容。如果描述超过 1000 字,脚本会自动截断到 800 字。
bash# 用户在浏览器中确认预览后 python scripts/cli.py click-publish
success, title, images/video/templates, status。--headless 且自动降级,JSON 中 action 为 switched_to_headed。error 字段。| 参数 | 说明 | |------|------| | --title-file path | 标题文件路径(必须) | | --content-file path | 正文文件路径(必须) | | --images path1 path2 | 图片路径/URL 列表(图文必须) | | --video path | 视频文件路径(视频必须) | | --tags tag1 tag2 | 话题标签列表 | | --schedule-at ISO8601 | 定时发布时间 | | --original | 声明原创 | | --visibility | 可见范围 | | --headless | 无头模式(未登录自动降级到有窗口模式) | | --host HOST | 远程 CDP 主机 | | --port PORT | CDP 端口(默认 9222) | | --account name | 指定账号 |
--headless 时会自动降级到有窗口模式。Other measured skills in the registry, with their headline benchmark lift.