Obtain a watermark-free video download link from a Douyin share link, download the video, and use speech recognition to extract the copy from the video, automatically saving it to a file.
Feature Overview
- Obtain Download Link: Parse a watermark-free video direct download address from a Douyin share link (no API key required)
- Download Video: Download the watermark-free video to a specified local directory
- Extract Copy: Extract text content from the video via speech recognition (requires a SiliconFlow API key)
- Automatic Save: Each video's copy is automatically saved to a separate folder (with the video ID as the folder name)
Environment Requirements
Dependency Installation
pip install requests ffmpeg-python
System Requirements
- FFmpeg must be installed on the system (for audio and video processing)
- macOS:
brew install ffmpeg - Ubuntu:
apt install ffmpeg
API Key Configuration (only required for copy extraction)
The copy extraction function uses the SiliconFlow API, and an environment variable needs to be set:
export API_KEY="your-siliconflow-api-key"
Obtain API key: https://cloud.siliconflow.cn/
Usage
Method 1: Use the script (recommended)
# 获取视频信息和下载链接 (无需 API 密钥)
python douyin_downloader.py --link "抖音分享链接" --action info
# 下载视频到指定目录
python douyin_downloader.py --link "抖音分享链接" --action download --output ./videos
# 提取视频文案并保存到文件 (需要 API_KEY 环境变量)
python douyin_downloader.py --link "抖音分享链接" --action extract --output ./output
# 提取文案并同时保存视频
python douyin_downloader.py --link "抖音分享链接" --action extract --output ./output --save-video
# 安静模式 (减少输出)
python douyin_downloader.py --link "抖音分享链接" --action extract --output ./output --quiet
Output Directory Structure
After extracting the copy, each video is saved to a separate folder:
output/
├── 7600361826030865707/ # 视频ID为文件夹名
│ └── transcript.md # Markdown 格式文案文件
├── 7581044356631612699/
│ ├── transcript.md
│ └── 7581044356631612699.mp4 # 使用 --save-video 时保存
└── ...
Markdown Copy Format
# 视频标题
| 属性 | 值 |
|------|-----|
| 视频ID | `7600361826030865707` |
| 提取时间 | 2026-01-30 14:19:00 |
| 下载链接 | [点击下载](url) |
---
## 文案内容
(语音识别的文字内容)
Method 2: Call in Python code
from douyin_downloader import get_video_info, download_video, extract_text
# 获取视频信息
info = get_video_info("抖音分享链接")
print(f"视频ID: {info['video_id']}")
print(f"标题: {info['title']}")
print(f"下载链接: {info['url']}")
# 下载视频
video_path = download_video("抖音分享链接", output_dir="./videos")
# 提取文案并保存到文件
result = extract_text("抖音分享链接", output_dir="./output")
print(f"文案已保存到: {result['output_path']}")
print(result['text'])
Workflow
Obtain Video Information
- Parse the Douyin share link and extract the real video URL
- Simulate a mobile client request to obtain page data
- Extract the watermark-free video address from the page JSON data
- Return the video ID, title, and download link
Extract Video Copy
- Parse the share link to obtain video information
- Download the video to a temporary directory
- Use FFmpeg to extract audio from the video (MP3 format)
- Call the SiliconFlow SenseVoice API for speech recognition
- Clean up temporary files and return the recognized text
FAQ
Unable to Parse Link
- Ensure the link is a valid Douyin share link
- The link format is usually
https://v.douyin.com/xxxxx/or a complete Douyin video URL
Copy Extraction Failed
- Check whether the
API_KEYenvironment variable has been set - Ensure the API key is valid and has sufficient quota
- Ensure FFmpeg is correctly installed
Slow Download Speed
- This depends on network conditions and video size
- The script will display download progress
Notes
- This tool is for learning and research purposes only
- Relevant laws and regulations must be complied with when using it
- Do not use it for any purpose that infringes copyright or violates the law