Loading...
Loading...
Extract watermark-free Douyin/TikTok videos and transcribe audio content using AI speech recognition
npx skill4agent add aradotso/mcp-skills douyin-video-extractorSkill by ara.so — MCP Skills collection.
douyin-mcp-server# Install uv (Python package manager)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install FFmpeg (required for audio processing)
# macOS
brew install ffmpeg
# Ubuntu/Debian
apt install ffmpeg
# Windows (with chocolatey)
choco install ffmpeg# Clone the repository
git clone https://github.com/yzfly/douyin-mcp-server.git
cd douyin-mcp-server
# Install dependencies
uv sync
# Set API key for transcription (optional, only needed for text extraction)
export API_KEY="sk-xxxxxxxxxxxxxxxx"# Start the web server
uv run python web/app.py
# Access in browser: http://localhost:8080claude_desktop_config.json{
"mcpServers": {
"douyin-mcp": {
"command": "uvx",
"args": ["douyin-mcp-server"],
"env": {
"API_KEY": "sk-xxxxxxxxxxxxxxxx"
}
}
}
}parse_douyin_video_infoget_douyin_download_linkextract_douyin_text# Get video information (no API key required)
uv run python douyin-video/scripts/douyin_downloader.py \
-l "https://v.douyin.com/xxxxx/" \
-a info
# Download watermark-free video
uv run python douyin-video/scripts/douyin_downloader.py \
-l "https://v.douyin.com/xxxxx/" \
-a download \
-o ./videos
# Extract transcript (requires API_KEY)
uv run python douyin-video/scripts/douyin_downloader.py \
-l "https://v.douyin.com/xxxxx/" \
-a extract \
-o ./output
# Extract transcript and save video
uv run python douyin-video/scripts/douyin_downloader.py \
-l "https://v.douyin.com/xxxxx/" \
-a extract \
-o ./output \
--save-video-l, --link-a, --actioninfodownloadextract-o, --output./output--save-video--api-keyfrom douyin_video.parser import DouyinParser
# Initialize parser
parser = DouyinParser()
# Parse video information
share_link = "https://v.douyin.com/xxxxx/"
video_info = parser.parse_video_info(share_link)
print(f"Title: {video_info['title']}")
print(f"Video ID: {video_info['video_id']}")
print(f"Download URL: {video_info['download_url']}")from douyin_video.downloader import DouyinDownloader
downloader = DouyinDownloader()
# Download watermark-free video
video_url = "https://v.douyin.com/xxxxx/"
output_path = "./videos"
file_path = downloader.download_video(video_url, output_path)
print(f"Video saved to: {file_path}")from douyin_video.transcriber import VideoTranscriber
import os
# Initialize with API key
api_key = os.getenv("API_KEY")
transcriber = VideoTranscriber(api_key=api_key)
# Extract transcript from video URL
video_url = "https://v.douyin.com/xxxxx/"
transcript = transcriber.extract_transcript(video_url)
print(f"Transcript: {transcript['text']}")
print(f"Video ID: {transcript['video_id']}")
print(f"Title: {transcript['title']}")
# Save as Markdown
transcriber.save_markdown(
transcript=transcript,
output_dir="./output"
)# Files >1 hour or >50MB are automatically chunked
# No special configuration needed
transcript = transcriber.extract_transcript(long_video_url)
# Chunks are processed and merged automaticallyexport API_KEY="sk-xxxxxxxxxxxxxxxx"uv run python douyin-video/scripts/douyin_downloader.py \
--api-key "sk-xxxxxxxxxxxxxxxx" \
-l "https://v.douyin.com/xxxxx/" \
-a extract# Video Title
| 属性 | 值 |
|------|-----|
| 视频ID | `7600361826030865707` |
| 提取时间 | 2026-01-30 14:19:00 |
| 下载链接 | [点击下载](url) |
---
## 文案内容
Transcribed text content appears here...from douyin_video.transcriber import VideoTranscriber
import os
api_key = os.getenv("API_KEY")
transcriber = VideoTranscriber(api_key=api_key)
video_urls = [
"https://v.douyin.com/xxxxx1/",
"https://v.douyin.com/xxxxx2/",
"https://v.douyin.com/xxxxx3/",
]
for url in video_urls:
try:
transcript = transcriber.extract_transcript(url)
transcriber.save_markdown(transcript, "./batch_output")
print(f"✓ Processed: {transcript['title']}")
except Exception as e:
print(f"✗ Failed {url}: {e}")from douyin_video.parser import DouyinParser
from douyin_video.exceptions import ParseError, DownloadError
parser = DouyinParser()
try:
video_info = parser.parse_video_info(share_link)
except ParseError as e:
print(f"Failed to parse video: {e}")
except DownloadError as e:
print(f"Failed to download: {e}")
except Exception as e:
print(f"Unexpected error: {e}")from douyin_video.transcriber import VideoTranscriber
import json
transcriber = VideoTranscriber(api_key=os.getenv("API_KEY"))
transcript = transcriber.extract_transcript(video_url)
# Save as JSON
with open("transcript.json", "w", encoding="utf-8") as f:
json.dump(transcript, f, ensure_ascii=False, indent=2)
# Extract specific fields
video_id = transcript["video_id"]
text_content = transcript["text"]
download_url = transcript["download_url"]FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'# Verify FFmpeg installation
ffmpeg -version
# If not installed, install via package manager
brew install ffmpeg # macOS
apt install ffmpeg # UbuntuUnauthorized: Invalid API keyecho $API_KEYRequest Entity Too LargeFailed to parse video linkhttps://v.douyin.com/PermissionError: [Errno 13] Permission denied# Ensure output directory exists and is writable
mkdir -p ./output
chmod 755 ./output
# Or specify a different output directory
uv run python douyin-video/scripts/douyin_downloader.py \
-l "url" -a extract -o ~/Documents/douyin_output# Ensure server is running
uv run python web/app.py
# Check if port 8080 is available
lsof -i :8080
# Use different port if needed
PORT=8081 uv run python web/app.pyfrom douyin_video.transcriber import VideoTranscriber
transcriber = VideoTranscriber(
api_key=os.getenv("API_KEY"),
model="FunAudioLLM/SenseVoiceSmall", # Default model
chunk_duration=540 # 9 minutes per chunk (default)
)from douyin_video.mcp_server import DouyinMCPServer
server = DouyinMCPServer(api_key=os.getenv("API_KEY"))
await server.run()