This skill is used to automate publishing videos to the WeChat Channels Creator Center.
Use cases
- When the user needs to publish videos to Channels
- When the user says "post to Channels", "upload to Channels", "publish to WeChat Channels"
- When the user has video files that need to be distributed to the Channels platform
Technical principles
Based on Playwright browser automation, simulating real user operations on the WeChat Channels Creator Center (https://channels.weixin.qq.com):
- First use requires WeChat QR code login and saves the cookie
- Subsequent use automatically logs in with the cookie
- Automatically fills in information such as title, topics, and short title
- Supports scheduled publishing, originality declaration, and adding to collections
Prerequisites
1. Install dependencies
pip install playwright
playwright install chromium
2. First login to obtain the cookie
python .opencode/skills/auto-weixin-video/scripts/get_cookie.py
After execution, the browser will open. Use WeChat to scan the QR code to log in. After a successful login, the cookie will be saved automatically.
Workflow
Step 1: Confirm login status
Check whether the cookie exists and is valid:
python .opencode/skills/auto-weixin-video/scripts/check_cookie.py
If the cookie has expired, you need to obtain it again:
python .opencode/skills/auto-weixin-video/scripts/get_cookie.py
Step 2: Prepare the video file
Video file requirements:
- Format:
.mp4(recommended) - Resolution: 1080x1920 recommended (vertical 9:16) or 1920x1080 (horizontal 16:9)
- Duration: within 1 minute is recommended for best results
Step 3: Publish the video
python .opencode/skills/auto-weixin-video/scripts/publish.py \
--video "视频文件路径" \
--title "视频标题" \
--tags "话题1,话题2,话题3" \
[--original] \
[--schedule "2025-01-31 18:00"]
Parameter description
| Parameter | Abbreviation | Description | Required |
|---|---|---|---|
--video |
-v |
Video file path | ✅ |
--title |
-t |
Video title | ✅ |
--tags |
-g |
Topic tags, separated by commas | ❌ |
--original |
-o |
Declare originality | ❌ |
--category |
-c |
Originality type (e.g., life, technology) | ❌ |
--schedule |
-s |
Scheduled publish time (format: YYYY-MM-DD HH:MM) | ❌ |
--draft |
Save as draft without publishing | ❌ | |
--headless |
Run in headless mode (do not show the browser) | ❌ |
Usage examples
# 立即发布
python .opencode/skills/auto-weixin-video/scripts/publish.py \
-v ~/Videos/demo.mp4 \
-t "今天学到一个超实用的技巧" \
-g "干货分享,效率提升,学习"
# 声明原创 + 定时发布
python .opencode/skills/auto-weixin-video/scripts/publish.py \
-v ~/Videos/demo.mp4 \
-t "周末vlog|一个人的惬意时光" \
-g "vlog,周末日常,生活记录" \
--original \
-s "2025-02-01 18:00"
# 保存为草稿
python .opencode/skills/auto-weixin-video/scripts/publish.py \
-v ~/Videos/demo.mp4 \
-t "测试视频" \
--draft
Directory structure
.opencode/skills/auto-weixin-video/
├── skill.md # 技能说明文档
├── scripts/
│ ├── get_cookie.py # 获取登录 Cookie
│ ├── check_cookie.py # 检查 Cookie 有效性
│ └── publish.py # 发布视频主脚本
└── cookies/
└── weixin_video.json # Cookie 存储文件(自动生成)
Notes
- Cookie validity period: WeChat cookies have a relatively short validity period. It is recommended to check before each use
- Publishing frequency: It is recommended to control the publishing frequency to avoid being identified by the platform as abnormal behavior
- Short title: The system will automatically generate a 6-16 character short title from the title
- Number of topics: It is recommended to add 3-5 related topics
- Originality declaration: Checking originality must comply with the platform's originality rules, otherwise penalties may be incurred
- Collection: If the account has collections, the video will automatically be added to the first collection
FAQ
Q: What should I do if the cookie expires?
A: Run again get_cookie.py and scan the QR code to log in.
Q: What should I do if the upload fails?
A: Check the network connection and confirm that the video file format is correct. Channels has the best support for H264 encoding.
Q: How do I publish in batches?
A: You can write a loop script to call them one by one, publish.py, it is recommended to leave a few minutes between each release.
Reference project
This skill refers to the implementation of the social-auto-upload project.