SuperAPI AI Directory

auto-douyin

General & other

View repository

Updated 10-15 21:53

About this skill

Douyin video automatic publishing skill

This skill is used to automate publishing videos to the Douyin Creator Center.

Use cases

  • When the user needs to publish a video to Douyin
  • When the user says "post to Douyin", "upload to Douyin", "publish to Douyin"
  • When the user has a video file that needs to be distributed to the Douyin platform

Technical principles

Based on Playwright browser automation, simulating real user operations on the Douyin Creator Center (https://creator.douyin.com):

  1. First use requires scanning a QR code to log in and saving the Cookie
  2. Subsequent uses automatically log in with the Cookie
  3. Automatically fill in the title, topics, cover, and other information
  4. Supports scheduled publishing

Prerequisites

1. Install dependencies

pip install playwright
playwright install chromium

2. First login to obtain Cookie

python .opencode/skills/auto-douyin/scripts/get_cookie.py

After execution, the browser will open. Use the Douyin APP 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-douyin/scripts/check_cookie.py

If the Cookie is invalid, it needs to be obtained again:

python .opencode/skills/auto-douyin/scripts/get_cookie.py

Step 2: Prepare the video file

Video file requirements:

  • Format:.mp4(recommended)
  • Resolution: 1080x1920 recommended (vertical 9:16)
  • File size: recommended not to exceed 4GB

Optional: prepare a cover image with the same name (.png or .jpg)

Step 3: Publish the video

python .opencode/skills/auto-douyin/scripts/publish.py \
    --video "视频文件路径" \
    --title "视频标题" \
    --tags "话题1,话题2,话题3" \
    [--cover "封面图片路径"] \
    [--schedule "2025-01-31 18:00"]

Parameter description

Parameter Abbreviation Description Required
--video -v Video file path ✅
--title -t Video title (maximum 30 characters) ✅
--tags -g Topic tags, separated by commas ❌
--cover -c Cover image path ❌
--schedule -s Scheduled publishing time (format: YYYY-MM-DD HH:MM) ❌
--headless Run in headless mode (do not display the browser) ❌

Usage example

# 立即发布,自动生成封面
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

Directory structure

.opencode/skills/auto-douyin/
├── skill.md              # 技能说明文档
├── scripts/
│   ├── get_cookie.py     # 获取登录 Cookie
│   ├── check_cookie.py   # 检查 Cookie 有效性
│   └── publish.py        # 发布视频主脚本
└── cookies/
    └── douyin.json       # Cookie 存储文件(自动生成)

Notes

  1. Cookie validity period: Cookies usually have a long validity period, but if they have not been used for a long time or the platform is updated, you may need to log in again
  2. Publishing frequency: It is recommended to control the publishing frequency to avoid being identified by the platform as abnormal behavior
  3. Title limit: Douyin titles are limited to 30 characters; anything beyond that will be automatically truncated
  4. Number of topics: It is recommended to add 3-5 related topics to increase exposure
  5. Cover selection: If no cover is specified, the system will automatically select a recommended cover from the video
  6. Scheduled publishing: The scheduled publishing time must be after the current time and within the time range allowed by the platform

FAQ

Q: What should I do if the Cookie is invalid?

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, confirm that the video file format is correct, and check the error information output by the script.

Q: How do I publish in batches?

A: You can write a loop script and call publish.py, it is recommended to leave an interval of a few minutes between each release.

Reference Project

This skill references the implementation of the social-auto-upload project.