A powerful command-line tool to download videos and images from Douyin (TikTok China) with automatic metadata extraction, intelligent concurrency optimization, and a beautiful terminal UI.
- Node.js >= 18.0.0
- npm or yarn
npm installRun without arguments to enter interactive mode:
npm start
# or
tsx main.tsYou'll be prompted to:
- Choose input source (URL or File)
- Enter URL or file path
- Choose output type (Download or JSON)
- Configure output directory/path
downloads/
├── 2024-11-22_16-30-45/
│ ├── 7568455934909926699.mp4
│ ├── 1234567890123456789.mp4
│ └── metadata/
│ └── download_1700656245000.json
└── 2024-11-22_17-15-20/
├── ...
When exporting JSON, files are named using video IDs:
- Single video:
{video_id}.json - Multiple videos:
output.json(or custom name)
{
"index": 1,
"media": {
"type": "video",
"video_id": "7568455934909926699",
"original_url": "https://www.douyin.com/video/...",
"download_url": "https://...",
"like": 12345,
"comment": 678,
"share": 90,
"save": 234,
"video_desc": "Video description",
"create_at": "2024-11-22 16:30:45"
},
"user": {
"username": "user123",
"name": "User Name",
"bio": "User bio",
"user_id": "123456789",
"sec_uid": "MS4wLjABAAAA..."
},
"user_videos": [
{
"video_id": "1234567890",
"desc": "Video description",
"like": 1000,
"comment": 50,
"create_at": "2024-11-22 16:30:45",
"original_url": "https://..."
}
]
}The tool automatically calculates optimal concurrency based on:
- CPU Cores: Number of available CPU cores
- Memory Usage: Current system memory usage
- Rules:
- Memory < 50%:
CPU cores × 2(max 10) - Memory < 70%:
CPU cores - Memory ≥ 70%:
CPU cores ÷ 2(min 2)
- Memory < 50%:
You can override this with --concurrency option.
- The tool automatically removes duplicate URLs
- Downloads are organized by timestamp for easy management
- Metadata includes original URLs, user information, and video statistics
- User video lists are automatically fetched when
sec_uidis available - JSON files are named using video IDs for single video exports
Contributions are welcome! Please feel free to submit a Pull Request.
ISC
Made with ❤️ for downloading Douyin content