SuperAPI AI Directory

weibo-transcribe

Writing & research

View repository

Updated 10-15 17:34

About this skill

Weibo Video Transcription Skill

Download the audio from a Weibo video, transcribe it to text with SenseVoice-Small, and save it as a Markdown file with frontmatter.

Environment Requirements

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

# 依赖
pip install funasr modelscope torch torchaudio

# 系统依赖
# macOS: brew install ffmpeg yt-dlp
# Ubuntu: sudo apt install ffmpeg && pip install yt-dlp

Usage

# 桌面端链接
python scripts/transcribe.py "https://weibo.com/xxxxx"

# 移动端链接(更稳定)
python scripts/transcribe.py "https://m.weibo.cn/xxxxx"

# 指定输出目录
python scripts/transcribe.py "https://m.weibo.cn/xxxxx" -o ./output

Workflow

Step 1: Download audio with yt-dlp

Weibo blocks desktop UAs fairly strictly, so the script automatically uses a mobile UA + Referer disguise. Prefer using m.weibo.cn links, which have a higher success rate.

yt-dlp --extract-audio --audio-format mp3 --audio-quality 128K \
  --user-agent "Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) ..." \
  --referer "https://m.weibo.cn/" \
  "https://m.weibo.cn/status/example"

Step 2: Transcribe with SenseVoice-Small

from funasr import AutoModel

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

The script automatically creates a Markdown file with frontmatter, including the source link, author, language, and transcribed text. Failed downloads are automatically retried.

Known Limitations

  • Link format: desktop weibo.com links are often blocked by anti-scraping measures; prefer using m.weibo.cn mobile links
  • Anti-scraping: Weibo blocks requests with non-mobile UAs and missing Referer fairly strictly; the script has a built-in mobile UA, but frequent requests may still trigger rate limiting
  • Login state: private posts and follower-only content require login; the current script does not carry a login state
  • Language: Weibo is primarily in Chinese, and the script defaults to language=zh; for English content, it is recommended to use youtube-transcribe instead
  • Model size: the first download of SenseVoice-Small is about 893MB

Acknowledgements

⚖️ 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 bulk scraping, commercial crawling, or scenarios that infringe on others' rights. The copyright of downloaded content belongs to the original author.