SuperAPI AI Directory

douyin-transcribe

General & other

View repository

Updated 10-15 17:34

About this skill

Douyin Video Transcription Skill

Download audio from Douyin videos, transcribe it into text using SenseVoice-Small, and save it as a Markdown file.

Environment Requirements

# Python 3.9+
python -m venv .venv
source .venv/bin/activate

# 依赖
pip install funasr modelscope torch torchaudio

# 系统依赖
# macOS: brew install ffmpeg
# Ubuntu: sudo apt install ffmpeg

Usage

python scripts/transcribe.py "https://v.douyin.com/xxxxx"

Workflow (3 steps)

Step 1: Download audio from Douyin

Use iesdouyin.com/share/video/<id> + mobile UA to get window._ROUTER_DATA, and extract the CDN download link.

Key points:

  • ✅ iesdouyin.com/share/video/ instead of douyin.com/video/
  • ✅ Mobile UA must be iPhone
  • ✅ playwm → play to remove watermark
  • ⚠️ Prefer direct scraping without cookies; if the share page returns a spider shell (rate limiting), automatically fall back to yt-dlp + YTDLP_COOKIES_FROM_BROWSER(just having opened douyin.com in the browser is enough, no login required)

Step 2: SenseVoice-Small transcription

from funasr import AutoModel
from funasr.utils.postprocess_utils import rich_transcription_postprocess

model = AutoModel(
    model="iic/SenseVoiceSmall",
    trust_remote_code=True,
    vad_model="fsmn-vad",
    vad_kwargs={"max_single_segment_time": 30000},
    device="cpu",
)

result = model.generate(input=audio_path, language="zh", use_itn=True, batch_size_s=60)

Step 3: Generate Markdown

Automatically create a Markdown file with frontmatter.

Performance Data

Video duration Model loading Transcription time Total time
10 min ~30s ~25s ~1 min
30 min ~30s ~75s ~2 min
1h 22min ~40s ~180s ~4 min

Known Limitations

  • The first download of the SenseVoice-Small model is about 893MB (from ModelScope, fast in China)
  • CPU inference quality is slightly lower than GPU, but Chinese is still better than Whisper-small
  • VAD automatic segmentation may split long pauses into two segments
  • Speaker diarization is not supported
  • yt-dlp is unavailable (requires cookies), so the iesdouyin route must be used

Reference Projects

⚖️ Compliance Statement

Forpersonal learning and researchuse only. Please comply with the target platform's Terms of Service (ToS) and robots rules, control request frequency, and do not use it for batch scraping, commercial crawling, or scenarios that infringe on others' rights. The copyright of downloaded content belongs to the original author.