douyin-video
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese抖音无水印视频下载和文案提取
Watermark-Free Douyin Video Download and Transcript Extraction
从抖音分享链接获取无水印视频下载链接, 下载视频, 并使用语音识别提取视频中的文案, 自动保存到文件.
Retrieve watermark-free video download links from Douyin share links, download videos, and extract text content from videos via speech recognition, then automatically save to files.
功能概述
Feature Overview
- 获取下载链接: 从抖音分享链接解析出无水印视频的直接下载地址 (无需 API 密钥)
- 下载视频: 将无水印视频下载到本地指定目录
- 提取文案: 通过语音识别从视频中提取文字内容 (需要硅基流动 API 密钥)
- 自动保存: 每个视频的文案自动保存到独立文件夹 (视频ID为文件夹名)
- Get Download Link: Parse the direct download address of watermark-free videos from Douyin share links (no API key required)
- Download Video: Download watermark-free videos to a specified local directory
- Extract Transcript: Extract text content from videos through speech recognition (requires SiliconFlow API key)
- Auto-Save: Transcripts of each video are automatically saved to an independent folder (folder name is the video ID)
环境要求
Environment Requirements
依赖安装
Dependency Installation
bash
pip install requests ffmpeg-pythonbash
pip install requests ffmpeg-python系统要求
System Requirements
- FFmpeg 必须安装在系统中 (用于音视频处理)
- macOS:
brew install ffmpeg - Ubuntu:
apt install ffmpeg
- FFmpeg must be installed on the system (for audio and video processing)
- macOS:
brew install ffmpeg - Ubuntu:
apt install ffmpeg
API 密钥配置 (仅文案提取需要)
API Key Configuration (Only required for transcript extraction)
文案提取功能使用硅基流动 API, 需要设置环境变量:
bash
export API_KEY="your-siliconflow-api-key"获取 API 密钥: https://cloud.siliconflow.cn/
The transcript extraction function uses the SiliconFlow API, which requires setting an environment variable:
bash
export API_KEY="your-siliconflow-api-key"Get API key: https://cloud.siliconflow.cn/
使用方法
Usage
方法一: 使用脚本 (推荐)
Method 1: Use the Script (Recommended)
bash
undefinedbash
undefined获取视频信息和下载链接 (无需 API 密钥)
Get video information and download link (no API key required)
python douyin_downloader.py --link "抖音分享链接" --action info
python douyin_downloader.py --link "Douyin share link" --action info
下载视频到指定目录
Download video to specified directory
python douyin_downloader.py --link "抖音分享链接" --action download --output ./videos
python douyin_downloader.py --link "Douyin share link" --action download --output ./videos
提取视频文案并保存到文件 (需要 API_KEY 环境变量)
Extract video transcript and save to file (requires API_KEY environment variable)
python douyin_downloader.py --link "抖音分享链接" --action extract --output ./output
python douyin_downloader.py --link "Douyin share link" --action extract --output ./output
提取文案并同时保存视频
Extract transcript and save video at the same time
python douyin_downloader.py --link "抖音分享链接" --action extract --output ./output --save-video
python douyin_downloader.py --link "Douyin share link" --action extract --output ./output --save-video
安静模式 (减少输出)
Quiet mode (reduce output)
python douyin_downloader.py --link "抖音分享链接" --action extract --output ./output --quiet
undefinedpython douyin_downloader.py --link "Douyin share link" --action extract --output ./output --quiet
undefined输出目录结构
Output Directory Structure
提取文案后, 每个视频会保存到独立文件夹:
output/
├── 7600361826030865707/ # 视频ID为文件夹名
│ └── transcript.md # Markdown 格式文案文件
├── 7581044356631612699/
│ ├── transcript.md
│ └── 7581044356631612699.mp4 # 使用 --save-video 时保存
└── ...After extracting transcripts, each video will be saved to an independent folder:
output/
├── 7600361826030865707/ # Folder name is video ID
│ └── transcript.md # Markdown format transcript file
├── 7581044356631612699/
│ ├── transcript.md
│ └── 7581044356631612699.mp4 # Saved when using --save-video
└── ...Markdown 文案格式
Markdown Transcript Format
markdown
undefinedmarkdown
undefined视频标题
Video Title
| 属性 | 值 |
|---|---|
| 视频ID | |
| 提取时间 | 2026-01-30 14:19:00 |
| 下载链接 | 点击下载 |
| Attribute | Value |
|---|---|
| Video ID | |
| Extraction Time | 2026-01-30 14:19:00 |
| Download Link | Click to download |
文案内容
Transcript Content
(语音识别的文字内容)
undefined(Speech recognition text content)
undefined方法二: 在 Python 代码中调用
Method 2: Call in Python Code
python
from douyin_downloader import get_video_info, download_video, extract_textpython
from douyin_downloader import get_video_info, download_video, extract_text获取视频信息
Get video information
info = get_video_info("抖音分享链接")
print(f"视频ID: {info['video_id']}")
print(f"标题: {info['title']}")
print(f"下载链接: {info['url']}")
info = get_video_info("Douyin share link")
print(f"Video ID: {info['video_id']}")
print(f"Title: {info['title']}")
print(f"Download Link: {info['url']}")
下载视频
Download video
video_path = download_video("抖音分享链接", output_dir="./videos")
video_path = download_video("Douyin share link", output_dir="./videos")
提取文案并保存到文件
Extract transcript and save to file
result = extract_text("抖音分享链接", output_dir="./output")
print(f"文案已保存到: {result['output_path']}")
print(result['text'])
undefinedresult = extract_text("Douyin share link", output_dir="./output")
print(f"Transcript saved to: {result['output_path']}")
print(result['text'])
undefined工作流程
Workflow
获取视频信息
Get Video Information
- 解析抖音分享链接, 提取真实的视频 URL
- 模拟移动端请求获取页面数据
- 从页面 JSON 数据中提取无水印视频地址
- 返回视频 ID, 标题和下载链接
- Parse Douyin share link to extract the actual video URL
- Simulate mobile request to get page data
- Extract watermark-free video address from page JSON data
- Return video ID, title and download link
提取视频文案
Extract Video Transcript
- 解析分享链接获取视频信息
- 下载视频到临时目录
- 使用 FFmpeg 从视频中提取音频 (MP3 格式)
- 调用硅基流动 SenseVoice API 进行语音识别
- 清理临时文件, 返回识别的文本
- Parse share link to get video information
- Download video to temporary directory
- Use FFmpeg to extract audio from video (MP3 format)
- Call SiliconFlow SenseVoice API for speech recognition
- Clean up temporary files and return recognized text
常见问题
FAQs
无法解析链接
Failed to Parse Link
- 确保链接是有效的抖音分享链接
- 链接格式通常为 或完整的抖音视频 URL
https://v.douyin.com/xxxxx/
- Ensure the link is a valid Douyin share link
- Link format is usually or a full Douyin video URL
https://v.douyin.com/xxxxx/
提取文案失败
Failed to Extract Transcript
- 检查 环境变量是否已设置
API_KEY - 确保 API 密钥有效且有足够的配额
- 确保 FFmpeg 已正确安装
- Check if the environment variable is set
API_KEY - Ensure the API key is valid and has sufficient quota
- Ensure FFmpeg is installed correctly
下载速度慢
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
- Comply with relevant laws and regulations when using
- Do not use it for any copyright infringement or illegal purposes