| name | xhs-autoposter |
| description | 自动发布内容到小红书创作者平台。自动生成封面图、上传图片、填写标题正文、自动发布。支持两种封面风格:dark_tech(深色科技)和 bright_viral(小红书爆款亮色)。 |
| version | 1.0.0 |
| author | happydog-intj |
| requires | {"pip":["pillow>=10.0","playwright>=1.40"],"playwright":"chromium"} |
| tags | ["小红书","自动化","Python","社交媒体"] |
xhs-autoposter
小红书自动发帖工具 — 生成封面、自动登录、一键发布。
安装
git clone https://github.com/happydog-intj/xhs-autoposter
cd xhs-autoposter
pip install -r requirements.txt
python -m playwright install chromium
快速使用
命令行
python -m xhs_autoposter \
--title "AI自动发小红书!" \
--content "发现神仙工具!全程自动..." \
--tags "Python,AI,效率工具" \
--style bright_viral \
--subtitle "一键发帖神器" \
--github github.com/happydog-intj/xhs-autoposter
Python API
from xhs_autoposter import PostConfig, run
config = PostConfig(
title="AI自动发小红书!",
content="发现神仙工具...",
tags=["Python", "AI", "效率工具"],
cover_style="bright_viral",
cover_subtitle="一键发帖神器",
cover_emoji="🤖",
github_url="github.com/user/repo",
)
run(config)
封面风格对比
| 风格 | 适用场景 | 背景 | 主色 |
|---|
bright_viral | 生活/运营/爆款内容 | 白色/浅粉 | 小红书红 #FF2442 |
dark_tech | 技术/开源/极客内容 | 深海蓝紫渐变 | 红色 #FF5252 |
完整流程
python -m xhs_autoposter ...
↓ 生成封面图(Pillow)
↓ 打开 Chromium 浏览器
↓ [用户扫码登录] ← 唯一手动操作
↓ 自动检测登录成功
↓ 自动切换「上传图文」tab
↓ 自动上传封面图
↓ 自动填写正文 + 标题
↓ 5秒倒计时
↓ 自动点击发布
↓ 完成
配置参数
| 参数 | 类型 | 默认值 | 说明 |
|---|
title | str | 必填 | 标题(自动截断到20字) |
content | str | 必填 | 正文内容 |
tags | list[str] | [] | 标签列表 |
cover_style | str | bright_viral | 封面风格 |
cover_subtitle | str | "" | 封面副标题 |
cover_emoji | str | "🤖" | 装饰 emoji |
github_url | str | "" | 显示在封面和正文的链接 |
auto_publish | bool | True | 全自动发布 |
countdown_sec | int | 5 | 自动发布前倒计时秒数 |
许可证
MIT