douyin-batch-download

Original🇨🇳 Chinese
Translated
11 scripts

Douyin Video Batch Download Tool - Implements efficient, incremental video download functionality based on the F2 framework. Supports single/batch creator download, automatic Cookie management, and differential update mechanism. This skill should be used when users need to batch download videos from specific creators, deploy automated downloads on servers, or regularly update video libraries.

4installs
Added on

NPX Install

npx skill4agent add cat-xierluo/legal-skills douyin-batch-download

SKILL.md Content (Chinese)

View Translation Comparison →

Douyin Video Batch Download

This skill implements batch download of Douyin videos based on the F2 framework, providing efficient and stable batch download capabilities.

Feature Overview

  • Single Creator Download - Enter the homepage link or ID to download all or a specified number of videos
  • Batch Download - Specify multiple creators at once for batch processing
  • Incremental Download - Automatically skip already downloaded videos (judged by aweme_id)
  • Cookie Management - Prioritizes automatic reading from the browser; prompts for manual configuration if it fails
  • Following List Management - Maintains following.json to record processed creators
  • Differential Update - Supports downloading only videos that exist on the homepage but not locally
  • Directory Compatibility - Uses numeric ID + three-layer structure (video/cover/transcribed text)
  • Video Compression - Uses ffmpeg to compress videos and save storage space
  • Video Metadata - Captures and saves video statistics (like count, comment count, collect count, share count)
  • Data Visualization - Web interface displays statistical information of creators and videos, supporting sorting and filtering

Usage Scenarios

  • Server Batch Download: Deploy on a dedicated server to regularly batch capture videos from specific creators
  • Regular Video Library Update: Automatically detects new videos and only downloads missing ones
  • Backup and Migration: Video files are stored categorically for easy backup and subsequent processing
  • Content Analysis: Conduct creator content analysis based on video statistics (likes, comments, collects)

Video Metadata

When downloading videos, the system automatically extracts and saves the following data:
FieldDescription
aweme_id
Unique video ID
uid
Creator UID
desc
Video description/copy
create_time
Release time
duration
Video duration
digg_count
Like count
comment_count
Comment count
collect_count
Collect count
share_count
Share count
Data is stored in the
video_metadata
table of
douyin_users.db
.

Manual Extraction/Update of Metadata

bash
# Scan local videos and extract metadata (basic information)
python scripts/extract-metadata.py

# View statistical summary
python scripts/extract-metadata.py --stats
⚠️ Note: The
--fetch
option has been deprecated. It is recommended to re-download videos using
download-v2.py
, which will automatically save statistical data.

Quick Start

bash
# Create configuration
mkdir -p config
cp config/config.yaml.example config/config.yaml

# Edit configuration (fill in Cookie)
${EDITOR:-nano} config/config.yaml

# Single download (recommended)
python scripts/download-v2.py "https://www.douyin.com/user/MS4wLjABAAAA..."

# Batch download
python scripts/batch-download.py --all

# Interactive selection of creators for download
python scripts/batch-download.py

# Sample download (1 video per creator, quick data update)
python scripts/batch-download.py --sample

# Generate Web interface data
python scripts/generate-data.py

# View Web interface
open downloads/index.html

Recommended Workflow

1. Add creators → python scripts/manage-following.py --batch
2. Batch download → python scripts/batch-download.py --all
3. View data → open downloads/index.html
Automatically saves during download:
  • ✅ Video files
  • ✅ Like, comment, collect, share counts
  • ✅ Video description, release time, duration

Directory Structure

skills/douyin-batch-download/
├── SKILL.md                  # This file
├── references/
│   ├── INSTALLATION.md        # Detailed dependency installation instructions
│   └── USAGE.md              # Detailed usage instructions
├── scripts/
│   ├── download-v2.py        # ✅ Recommended download script (automatically saves statistical data)
│   ├── batch-download.py     # Batch download entry
│   ├── download.py           # ⚠️ Legacy download script (deprecated)
│   ├── manage-following.py   # Following list management (add/delete/search)
│   ├── sync-following.py     # Sync following.json from F2 database
│   ├── compress.py           # Video compression script
│   ├── extract-metadata.py   # Video metadata extraction
│   ├── generate-data.py      # Generate Web interface data files
│   ├── following.py          # following.json operation library
│   └── login.py              # QR code login script
├── config/
│   ├── config.yaml.example  # Configuration template
│   └── following.json       # Following list (downloaded creators)
├── downloads/
│   ├── {uid}/               # Video directory categorized by creator UID
│   ├── data.js              # Web interface data file
│   └── index.html           # Web management interface
└── douyin_users.db          # SQLite database (user info + video metadata)

Dependencies

System Dependencies

DependencyInstallation Method
Chrome/ChromiumDownload Link
ffmpegmacOS:
brew install ffmpeg
/ Ubuntu:
sudo apt install ffmpeg
ffmpeg is used for video compression; it can be omitted if only download functionality is needed.

Python Packages

| Package Name | Purpose | |------|------|----------| |
f2
| Douyin video download framework | |
playwright
| Browser automation (QR code login) | |
pyyaml
| YAML configuration file parsing | |
httpx
| Asynchronous HTTP client | |
aiofiles
| Asynchronous file operations |
Detailed Installation Instructions: See references/INSTALLATION.md
Detailed Usage Instructions: See references/USAGE.md

Reference Resources

Collaboration with Other Skills

FunASR Speech-to-Text

Downloaded videos can use the funasr-transcribe skill to transcribe videos into timestamped Markdown files.
Collaboration Method: First use the Douyin download skill to obtain videos, then use the FunASR skill for transcription. The two skills run independently and can be flexibly combined as needed.