This automates video publishing to Douyin (TikTok's Chinese version) through browser automation with Playwright. You scan a QR code once to save your login cookie, then call the publish script with your video file, title, and optional tags or scheduling time. It handles the whole creator center workflow: uploading, setting metadata, choosing covers, and posting immediately or on a timer. The implementation is based on social-auto-upload and works headless if you need it running in the background. Worth noting that you'll want to control your publishing frequency since it's simulating real browser interactions, and cookies eventually expire so you'll need to re-authenticate periodically.
npx -y skills add zrt-ai-lab/opencode-skills --skill auto-douyin --agent claude-codeInstalls into .claude/skills of the current project.
这个技能用于自动化发布视频到抖音创作者中心。
基于 Playwright 浏览器自动化,模拟真实用户操作抖音创作者中心(https://creator.douyin.com):
pip install playwright
playwright install chromium
python .opencode/skills/auto-douyin/scripts/get_cookie.py
执行后会打开浏览器,使用抖音 APP 扫码登录,登录成功后 Cookie 会自动保存。
检查 Cookie 是否存在且有效:
python .opencode/skills/auto-douyin/scripts/check_cookie.py
如果 Cookie 失效,需要重新获取:
python .opencode/skills/auto-douyin/scripts/get_cookie.py
视频文件要求:
.mp4(推荐)可选:准备同名的封面图片(.png 或 .jpg)
python .opencode/skills/auto-douyin/scripts/publish.py \
--video "视频文件路径" \
--title "视频标题" \
--tags "话题1,话题2,话题3" \
[--cover "封面图片路径"] \
[--schedule "2025-01-31 18:00"]
| 参数 | 简写 | 说明 | 必填 |
|---|---|---|---|
--video | -v | 视频文件路径 | ✅ |
--title | -t | 视频标题(最多30字) | ✅ |
--tags | -g | 话题标签,逗号分隔 | ❌ |
--cover | -c | 封面图片路径 | ❌ |
--schedule | -s | 定时发布时间(格式:YYYY-MM-DD HH:MM) | ❌ |
--headless | 无头模式运行(不显示浏览器) | ❌ |
# 立即发布,自动生成封面
python .opencode/skills/auto-douyin/scripts/publish.py \
-v ~/Videos/demo.mp4 \
-t "今天学到一个超实用的技巧" \
-g "干货分享,效率提升,学习"
# 定时发布,指定封面
python .opencode/skills/auto-douyin/scripts/publish.py \
-v ~/Videos/demo.mp4 \
-t "周末vlog|一个人的惬意时光" \
-g "vlog,周末日常,生活记录" \
-c ~/Videos/demo_cover.png \
-s "2025-02-01 18:00"
# 无头模式(后台运行)
python .opencode/skills/auto-douyin/scripts/publish.py \
-v ~/Videos/demo.mp4 \
-t "测试视频" \
--headless
.opencode/skills/auto-douyin/
├── skill.md # 技能说明文档
├── scripts/
│ ├── get_cookie.py # 获取登录 Cookie
│ ├── check_cookie.py # 检查 Cookie 有效性
│ └── publish.py # 发布视频主脚本
└── cookies/
└── douyin.json # Cookie 存储文件(自动生成)
A: 重新运行 get_cookie.py 扫码登录即可。
A: 检查网络连接,确认视频文件格式正确,查看脚本输出的错误信息。
A: 可以编写循环脚本,依次调用 publish.py,建议每次发布间隔几分钟。
本技能参考了 social-auto-upload 项目的实现。
sickn33/antigravity-awesome-skills
moizibnyousaf/ai-agent-skills
github/awesome-copilot