youtube-transcript-cn

Original🇨🇳 Chinese
Translated
1 scriptsChecked / no sensitive code detected

Extract subtitles from YouTube video links and convert them into Chinese transcripts. Supports both auto-generated and manual subtitles. Usage scenarios: (1) Users provide a YouTube link and request subtitle/transcript extraction, (2) Users request to convert YouTube video content into text, (3) Users say "Help me convert this YouTube video to text" or similar requests. Trigger words: YouTube subtitles, video to text, extract subtitles, YouTube transcript, video text draft.

3installs
Added on

NPX Install

npx skill4agent add zephyrwang6/myskill youtube-transcript-cn

SKILL.md Content (Chinese)

View Translation Comparison →

YouTube Subtitle Extraction Skill

Extract subtitles from YouTube videos and output Chinese transcripts.

Quick Start

bash
python3 scripts/get_transcript.py "https://www.youtube.com/watch?v=VIDEO_ID"

Workflow

  1. Get video link: Extract YouTube URL from user messages
  2. Run script: Execute
    scripts/get_transcript.py
    to extract subtitles
  3. Process output:
    • If subtitles are in Chinese: Output directly
    • If subtitles are in English: Translate to Chinese before output
  4. Save results: Save as Markdown file per user requirements

Script Parameters

ParameterDescriptionDefault Value
url
YouTube video link or IDRequired
-f, --format
Output format:
text
,
markdown
,
json
markdown
-t, --timestamps
Include timestampsNo
-l, --lang
Preferred languages (comma separated)
zh,en
-o, --output
Output file pathstdout

Usage Examples

Basic Usage

bash
python3 scripts/get_transcript.py "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

Output with Timestamps

bash
python3 scripts/get_transcript.py -t "https://youtu.be/VIDEO_ID"

Save to File

bash
python3 scripts/get_transcript.py -o output.md "https://www.youtube.com/watch?v=VIDEO_ID"

JSON Format (for easy post-processing)

bash
python3 scripts/get_transcript.py -f json "VIDEO_ID"

Supported URL Formats

  • https://www.youtube.com/watch?v=VIDEO_ID
  • https://youtu.be/VIDEO_ID
  • https://www.youtube.com/embed/VIDEO_ID
  • Direct use of Video ID

Language Priority

The script looks for subtitles in the following order:
  1. Simplified Chinese (zh-Hans)
  2. Traditional Chinese (zh-Hant)
  3. Chinese (zh)
  4. English (en)
  5. Auto-generated subtitles

Translation Processing

If the acquired subtitles are in English, they need to be translated into Chinese:
  1. Run the script to get English subtitles
  2. Use Claude's built-in capability to translate into fluent Chinese
  3. Maintain the original structure and paragraph division

Error Handling

ErrorCauseSolution
No captions availableThe video has no subtitlesInform the user that there are no available subtitles for this video
Cannot extract video IDURL format errorAsk the user to provide a correct YouTube link
Network timeoutNetwork problemRetry or check network connection

Output Format Example

Markdown Format

markdown
# 视频标题

- **Video ID**: abc123
- **语言**: 中文(自动生成)
- **链接**: https://www.youtube.com/watch?v=abc123

---

## 文字稿

这是视频的第一段内容...

这是视频的第二段内容...