wechat-draft-publisher
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese微信公众号草稿发布器(小龙虾极速版)
WeChat Official Account Draft Publisher (Crayfish Express Version)
核心理念:首次引导配置,之后一键发布
Core Concept: Guide configuration on first use, one-click publishing afterwards
前置:安装依赖
Prerequisite: Install Dependencies
每次使用前,先确保依赖已安装(幂等操作,可重复执行):
bash
pip3 install -r skills/wechat-draft-publisher/requirements.txtBefore each use, ensure dependencies are installed (idempotent operation, can be executed repeatedly):
bash
pip3 install -r skills/wechat-draft-publisher/requirements.txt首次使用:引导配置
First-time Use: Guided Configuration
第1步:查询IP并告知用户
Step 1: Query IP and Notify User
每次首次使用或遇到IP白名单错误时,先帮用户查询IP:
bash
python publisher.py --query-ip这会自动查询公网IP并显示:
>>> 你的公网IP是: x.x.x.x
请将此IP添加到微信公众号后台:
1. 登录 https://developers.weixin.qq.com/platform
2. 设置与开发 → 基本配置 → IP白名单
3. 添加IP: x.x.x.x告诉用户:
首次使用需要配置两件事:
1. IP白名单:我已查到你的服务器IP是 x.x.x.x
请登录微信公众号后台,在 设置与开发→基本配置→IP白名单 中添加这个IP
2. AppID和AppSecret:
在同一页面(基本配置)中复制AppID和AppSecret
运行发布工具时会自动引导你填写
配置好了告诉我,我就帮你发布!Query IP for users when using for the first time or encountering IP whitelist errors:
bash
python publisher.py --query-ipThis will automatically query the public IP and display:
>>> Your public IP is: x.x.x.x
Please add this IP to the WeChat Official Account backend:
1. Log in to https://developers.weixin.qq.com/platform
2. Settings & Development → Basic Configuration → IP Whitelist
3. Add IP: x.x.x.xTell the user:
Two configurations are required for first-time use:
1. IP Whitelist: I have found your server IP is x.x.x.x
Please log in to the WeChat Official Account backend, and add this IP in Settings & Development→Basic Configuration→IP Whitelist
2. AppID and AppSecret:
Copy AppID and AppSecret from the same page (Basic Configuration)
The publishing tool will automatically guide you to fill them in when running
Let me know once configured, and I will help you publish!第2步:运行发布器(自动引导输入凭证)
Step 2: Run the Publisher (Automatically Guide Credential Input)
bash
python publisher.py --title "文章标题" --content article.html首次运行会自动提示输入 AppID 和 AppSecret。
bash
python publisher.py --title "Article Title" --content article.htmlThe first run will automatically prompt you to enter AppID and AppSecret.
正常发布流程(配置完成后)
Normal Publishing Process (After Configuration)
一键发布
One-click Publishing
bash
python publisher.py \
--title "文章标题" \
--content xxx_formatted.html \
--cover cover.png \
--author "小龙虾"bash
python publisher.py \
--title "Article Title" \
--content xxx_formatted.html \
--cover cover.png \
--author "Crayfish"自动执行步骤
Automatic Execution Steps
- 找 HTML 文件:优先 ,回退最新
*_formatted.html.html - 提取标题:从 HTML 注释或文件名
- 找封面图:
cover.png - 调用发布:上传封面 → 上传内容图片 → 创建草稿
- 返回结果:显示 media_id,提示去后台查看
- Find HTML File: Prioritize , fall back to the latest
*_formatted.html.html - Extract Title: From HTML comments or file name
- Find Cover Image:
cover.png - Call Publishing: Upload cover → Upload content images → Create draft
- Return Result: Display media_id, prompt to check in backend
发布成功后提示
Prompt After Successful Publishing
✅ 文章已推送到草稿箱!
接下来:
1. 登录 https://developers.weixin.qq.com/platform
2. 进入"草稿箱"
3. 预览效果,确认后发布
⚠️ 草稿不会自动发布,你可以在后台编辑后再发✅ Article has been pushed to the draft box!
Next steps:
1. Log in to https://developers.weixin.qq.com/platform
2. Enter "Draft Box"
3. Preview the effect, then publish after confirmation
⚠️ Drafts will not be published automatically, you can edit them in the backend before publishing常见错误速查
Quick Troubleshooting
| 错误 | 原因 | 解决 |
|---|---|---|
| IP不在白名单 | 运行 |
| 凭证错误 | 检查 |
| 标题太长 | 工具会自动截断,无需处理 |
| 公众号类型不支持 | 需要认证的服务号 |
| Error | Cause | Solution |
|---|---|---|
| IP is not in whitelist | Run |
| Invalid credential | Check |
| Title is too long | The tool will automatically truncate it, no manual handling needed |
| Official Account type does not support | Authenticated service account is required |
配置文件位置
Configuration File Location
~/.wechat-publisher/config.jsonjson
{
"appid": "xxx",
"appsecret": "xxx"
}~/.wechat-publisher/config.jsonjson
{
"appid": "xxx",
"appsecret": "xxx"
}完整工作流联动
Complete Workflow Integration
写文章(tech-writer/pm-writer) → 美化格式(formatter) → 推送到微信(本skill)用户只需要说三句话:
- "写一篇关于XXX的文章"
- "美化文章"
- "推送到微信"
Write article(tech-writer/pm-writer) → Format beautification(formatter) → Push to WeChat(this skill)Users only need to say three sentences:
- "Write an article about XXX"
- "Beautify the article"
- "Push to WeChat"