YouTube转录

tools-only2026-10-25查看 1826复制 648

提取 YouTube 视频转录文本及元数据,并以 Markdown 格式保存到 Obsidian 仓库。当用户请求下载 YouTube 转录文本、将 YouTube 视频转换为文本,或提取视频字幕时使用此技能。不下载视频/音频文件,仅获取元数据和字幕。

Download (.md)

📘如何使用这个技能

  1. 1
    复制技能内容·点击上方「Copy SKILL.md」复制全部内容,或 Download 下载到本地
  2. 2
    打开你的 AI 客户端·支持 Claude Code、Trae、Cursor、ChatGPT、DeepSeek、Kimi 等任意 AI 助手
  3. 3
    粘贴为系统提示/知识文件·Claude Code:放入 .claude/skills/ 目录;普通对话:作为首条消息发送并说「请严格按这份技能文档执行」
  4. 4
    直接提出你的需求·AI 会按技能定义的工作流、格式和约束来处理,无需再解释背景

💡 提示:技能生效后,每次对话只需一句需求,AI 会按 SKILL.md 的流程执行。

SKILL.md2452 chars
---
name: youtube-transcript
description: "Extract YouTube video transcripts with metadata and save as Markdown to Obsidian vault. Use this skill when the user requests downloading YouTube transcripts, converting YouTube videos to text, or extracting video subtitles. Does not download video/audio files, only metadata and subtitles."
---

# YouTube Transcript

## Overview

Extract YouTube video transcripts, metadata, and chapters using yt-dlp. Output formatted as Markdown with YAML frontmatter, saved to ~/Brains/brain/ (Obsidian vault).

## Quick Start

To extract a transcript from a YouTube video:

```bash
python scripts/extract_transcript.py <youtube_url>
```

Optional: Specify custom output filename:

```bash
python scripts/extract_transcript.py <youtube_url> custom_filename.md
```

## Output Format

### YAML Frontmatter

The generated Markdown includes comprehensive metadata:

- `title` - Video title
- `channel` - Channel name
- `url` - YouTube URL
- `upload_date` - Upload date (YYYY-MM-DD)
- `duration` - Video duration (HH:MM:SS)
- `description` - Video description (truncated to 500 chars)
- `tags` - Array of video tags
- `view_count` - View count
- `like_count` - Like count

### Body Structure

Transcript organized by video chapters (if available):

```markdown
## Chapter Title

**00:05:23** Transcript text for this segment.

**00:05:45** Next segment text.
```

If no chapters exist, all content appears under "## Transcript" heading.

Timestamps formatted as HH:MM:SS for consistency.

## Workflow

1. Extract metadata and subtitles using yt-dlp
2. Parse VTT subtitle format to extract timestamps and text
3. Group transcript segments by video chapters (if present)
4. Format as Markdown with YAML frontmatter
5. Save to ~/Brains/brain/ with sanitized filename based on video title
6. Clean up temporary subtitle files

## Deduplication

To remove duplicates from existing transcript files:

```bash
python scripts/deduplicate_transcript.py <markdown_file>
```

This removes transcript entries that are prefixes of subsequent entries (common in VTT files where subtitles accumulate).

## Requirements

Ensure yt-dlp is installed:

```bash
pip install yt-dlp
```

## Limitations

- Extracts subtitles in English first, falls back to Russian if English unavailable
- Requires video to have subtitles (auto-generated or manual)
- Does not download video or audio files
- Description truncated to 500 characters in frontmatter
来源:skillsdirectory

评论0

登录后参与评论

还没有评论,来抢沙发吧