Automate Jianying (xyq.jianying.com) via Playwright to generate AI videos using the Seedance 2.0 model.
Prerequisites
- Python 3.9+ +
playwrightInstalled - Chromium via
playwright install chromiuminstalled - cookies.json — Jianying login credentials (exported from browser), placed in the same directory as the script
pip install playwright && playwright install chromium
Core Script
scripts/jianying_worker.py — Main automation script
Usage
Text-to-Video (T2V)
python3 scripts/jianying_worker.py \
--cookies /path/to/cookies.json \
--output-dir /path/to/output \
--prompt "赛博朋克风格的长安城,飞行汽车穿梭在霓虹灯笼之间" \
--duration 10s \
--model "Seedance 2.0"
Image-to-Video (I2V)
python3 scripts/jianying_worker.py \
--cookies /path/to/cookies.json \
--output-dir /path/to/output \
--ref-image /path/to/image.png \
--prompt "将这张图片变成动画,镜头从左向右缓慢平移" \
--duration 10s \
--model "Seedance 2.0 Fast"
Reference Video Generation (V2V)
python3 scripts/jianying_worker.py \
--cookies /path/to/cookies.json \
--output-dir /path/to/output \
--ref-video /path/to/reference.mp4 \
--prompt "画风改成宫崎骏风格,其他不变" \
--duration 10s \
--model "Seedance 2.0"
Extend
python3 scripts/jianying_worker.py \
--cookies /path/to/cookies.json \
--output-dir /path/to/output \
--extend-url 'https://xyq.jianying.com/home?tab_name=integrated-agent&thread_id=YOUR_THREAD_ID&agent_name=pippit_video_part_agent' \
--prompt "向后延伸,保持人物和镜头语言一致" \
--duration 5s
Dry-Run Mode (for debugging)
python3 scripts/jianying_worker.py --cookies /path/to/cookies.json --prompt "测试" --dry-run
Only fill out the form without submitting, generate
step_*.pngscreenshot for inspection. For V2V, dry-run now also outputs a表单状态JSON to confirm whether the reference video thumbnail is attached and whether the send button is unlocked.
Parameter Description
| Parameter | Default Value | Optional Values | Description |
|---|---|---|---|
--prompt |
"A beautiful woman dancing" | Any text | Video description |
--duration |
10s |
5s, 10s, 15s |
Video duration |
--ratio |
横屏 |
横屏, 竖屏, 方屏 |
Aspect ratio |
--model |
Seedance 2.0 |
Seedance 2.0, Seedance 2.0 Fast |
Model selection |
--ref-image |
None | Local image path | Reference image for I2V mode |
--ref-video |
None | Local video path | Reference video for V2V mode |
--extend-url |
None | thread link | Extend mode, continue generating based on an existing video |
--cookies |
cookies.json |
File path | Jianying login credential path |
--output-dir |
. |
Directory path | Output video save directory |
--dry-run |
false | - | Only fill out the form without submitting |
Models and Credits
| Model | Credits/Second | 5s | 10s | 15s | Features |
|---|---|---|---|---|---|
| Seedance 2.0 Fast | 3 | 15 | 30 | 45 | Fast, suitable for testing |
| Seedance 2.0 | 5 | 25 | 50 | 75 | High quality, for final production |
Automation Workflow
登录(cookies) → 选模式(沉浸式短片) → 选模型 → [上传参考素材/打开已有 thread 并点向后延伸] → 选时长 → 输入Prompt → 发送
→ 拦截 thread_id → 导航详情页 → 轮询视频 → curl 下载 MP4
Prompt Writing Guide
For detailed prompt examples and writing tips, see references/prompt-guide.md。
FAQ
Q: What should I do if the cookies expire? Log in to xyq.jianying.com in the browser and export cookies.json using an extension such as EditThisCookie.
Q: Download 403? The script uses the thread_id detail page + curl download; the CDN link does not require cookies. If it still fails, check the network.
Q: Uploading the reference video is very slow? This is normal; an 8MB video takes about 60-90 seconds. The script will automatically wait up to 5 minutes.