agentleFS
ChianWChianW/C31/skills/personal/C31-cvideo/SKILL.md

C31-cvideo

Skill1 starsChanged 3 months agoMITView on GitHub

接收 YouTube 链接 → 提取完整文字稿 → 保存到知识库 → 生成结构化分析

  • Reads credentials
  • Installs packages
  • Sends data out

The file

Files
SKILL.md

C31-Video-Ingest Skill

触发词

帮我看, 帮我总结, 看一下, 帮我总结这个视频, 看一下这个视频, 看这个视频

功能

接收任意 YouTube 链接 → 自动提取完整文字稿 → 保存到知识库 → 生成结构化分析

执行流程

Step 1: 接收链接

用户发送 YouTube 链接(支持多种格式):

  • https://www.youtube.com/watch?v=XXXX
  • https://youtu.be/XXXX
  • https://www.youtube.com/shorts/XXXX
  • 裸 video ID: XXXX

Step 2: 提取 Video ID

用正则表达式从各种 URL 格式中提取 11 位 video ID。

Step 3: 获取文字稿(主路径)

调用 youtube-transcript.ai MCP 服务器:

curl -X POST https://youtube-transcript.ai/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "get_youtube_transcript",
      "arguments": {"video": "VIDEO_ID", "lang": "en"}
    },
    "id": 1
  }'

特点:

  • 免费,无需 API key
  • 秒级返回
  • 支持多语言字幕选择(lang 参数)
  • 返回带时间戳的完整文字稿

Step 4: 兜底路径(无字幕视频)

如果 MCP 返回 TranscriptsDisabled 或 NoTranscriptFound:

  1. 检查环境变量 OPENAI_API_KEY
  2. 用 yt-dlp 提取音频(需 ffmpeg)
  3. 调用 OpenAI Whisper API 转录($0.006/分钟)

Step 5: 保存与归档

保存到: memory/moc/video_{video_id}_{timestamp}_{source}.md

Frontmatter 包含:

  • video_id
  • source (mcp / whisper)
  • fetched_at
  • url
  • duration
  • word_count

Step 6: 分析输出

自动分析并输出:

  • 核心信息: 主角、产品、成绩
  • 具体背景: 起点、早期失败、关键转折
  • 方法论: 步骤拆解、工具使用
  • 引爆案例: 具体帖子/内容、数据结果
  • 可应用方式: 映射到用户当前项目

依赖

工具必需安装命令
youtube-transcript.ai MCP✅无需安装,直调 API
python3✅系统自带
yt-dlp⚠️ 仅兜底pip install yt-dlp
ffmpeg⚠️ 仅兜底apt-get install ffmpeg
OPENAI_API_KEY⚠️ 仅兜底环境变量

脚本位置

~/.openclaw/scripts/c31-video-ingest.py

用法示例

# 直接给 video ID
python3 ~/.openclaw/scripts/c31-video-ingest.py 96jN2OCOfLs

# 给完整 URL
python3 ~/.openclaw/scripts/c31-video-ingest.py "https://www.youtube.com/watch?v=XXXX"

# 指定语言
python3 ~/.openclaw/scripts/c31-video-ingest.py XXXX --lang zh-CN

已知限制

  1. YouTube 直接访问在中国大陆环境可能超时(MCP 服务器在海外,通常可访问)
  2. MCP 返回的文字稿可能含重复行(YouTube 自动字幕的重复片段问题)
  3. 视频若无字幕且未配置 OPENAI_API_KEY,会失败

扩展方向

  • 支持 Bilibili(需单独接口)
  • 支持批量处理播放列表
  • 自动提取关键时间戳(AI 总结章节)
  • 与 C31-compound 联动:视频洞察自动归档到 solutions

验证记录

  • 2026-07-17: 测试通过,video_id=96jN2OCOfLs (Andrej Karpathy),成功提取 101K 字符
  • 2026-07-17: 测试通过,video_id=3X4VneEHvig (Avnish SaveWise),成功提取 48K 字符

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.