通用视频摘要工具,支持 YouTube 和 B站,支持单个视频、频道扫描、每日批量处理。
bash
cd ~/.openclaw/skills/youtube-summarizer
./setup.sh
安装完成后会引导你选择默认图文模式(可随时重新配置):
text
📋 选择默认图文模式:
1) text-only - 纯文字,不抽帧(最快)
2) auto-insert - 自动选帧插入文档(推荐平衡)
3) ai-review - AI 智能选图(默认,最佳效果,多消耗 ~5-8k token)
请选择 [1/2/3] (默认 3):
配置写入 config/settings.json,可随时运行 youtube-summarizer --setup 重新配置。
依赖:
yt-dlpyoutube-transcript-apiinnertube (绕过 YouTube 限流)faster-whisper(B站语音转录,本地,无需 API)ffmpeg(B站音频提取 + 关键帧,系统级安装)Skill 使用多种方法获取字幕,避免 YouTube 限流:
这种双重方法确保即使 YouTube 封锁直接 API 访问也能可靠获取字幕。
模式说明额外 tokentext-only纯文字,不抽帧0auto-insert固定规则选帧,按时间戳插入(帧偏移+5s避转场)05-8kai-review ← 默认基于文章结构反向选图,可补帧/删帧/替换
通过以下方式指定模式(优先级从高到低):
--modeSUMMARY_MODEconfig/settings.json 中的 default_modebash
youtube-summarizer --url "https://www.youtube.com/watch?v=VIDEO_ID"
bash
youtube-summarizer --url "https://www.bilibili.com/video/BV1xxxxx"
# 短链接也支持(自动跟随跳转)
youtube-summarizer --url "https://b23.tv/xxxxx"
# 指定图文模式
youtube-summarizer --url "https://www.bilibili.com/video/BV1xxxxx" --mode text-only
youtube-summarizer --url "https://www.bilibili.com/video/BV1xxxxx" --mode auto-insert
youtube-summarizer --url "https://www.bilibili.com/video/BV1xxxxx" --mode ai-review
# 自定义 whisper 模型(精度更高,但更慢)
youtube-summarizer --url "https://www.bilibili.com/video/BV1xxxxx" --whisper-model large-v3
# 跳过关键帧提取(等效 --mode text-only)
youtube-summarizer --url "https://www.bilibili.com/video/BV1xxxxx" --no-frames
# 自定义关键帧间隔(默认30秒一帧)
youtube-summarizer --url "https://www.bilibili.com/video/BV1xxxxx" --frame-interval 60
B站处理依赖:
yt-dlp + Chrome cookies(自动读取,绕过B站反爬)ffmpeg(音频提取 + 关键帧)faster-whisper(本地语音转文字,无需API)bash
youtube-summarizer --channel "UC_x5XG1OV2P6uZZ5FSM9Ttw" --hours 24
bash
youtube-summarizer --config /path/to/channels.json --daily --output /tmp/youtube_daily.json
channels.json:
json
{
"channels": [
{
"name": "Lex Fridman",
"id": "UCSHZKyawb77ixDdsGog4iWA",
"url": "https://www.youtube.com/@lexfridman"
},
{
"name": "Y Combinator",
"id": "UCcefcZRL2oaA_uBNeo5UOWg",
"url": "https://www.youtube.com/@ycombinator"
}
],
"hours_lookback": 24,
"min_duration_seconds": 300,
"max_videos_per_channel": 5
}
json
{
"generated_at": "2026-02-14T11:17:00Z",
"items": [
{
"title": "视频标题",
"url": "https://youtube.com/watch?v=...",
"video_id": "VIDEO_ID",
"platform": "youtube",
"channel": "频道名",
"duration": "15:30",
"published": "2026-02-14T08:00:00Z",
"has_transcript": true,
"summary": "# 摘要内容(markdown)\n\n### 🎯 核心问题...",
"metadata": {
"view_count": 12345,
"like_count": 678
}
},
{
"video_id": "BV1xxxxx",
"title": "B站视频标题",
"url": "https://www.bilibili.com/video/BV1xxxxx",
"platform": "bilibili",
"has_transcript": true,
"transcript_path": "/tmp/bili_BV1xxxxx_transcript.txt",
"frame_files": ["/tmp/bili_BV1xxxxx_frames/frame_001.jpg", "..."],
"frame_count": 12,
"summary": "# 摘要内容(markdown)..."
}
],
"stats": {
"total_videos": 5,
"with_transcript": 4,
"without_transcript": 1
}
}
bash
# 1. 运行 skill 生成摘要
youtube-summarizer --config youtube-channels.json --daily --output /tmp/youtube_summary.json
# 2. Agent 读取 JSON
summary=$(cat /tmp/youtube_summary.json)
# 3. Agent 处理:发送 Discord + 同步 Notion
# (在 agent prompt 或脚本中实现)
yaml
payload:
kind: agentTurn
message: |
执行 YouTube 每日摘要:
1. 运行 skill:
youtube-summarizer --config /Users/sophie/.openclaw/workspace-news/youtube-channels.json --daily --output /tmp/youtube_summary.json
2. 读取 /tmp/youtube_summary.json
3. 格式化并发送到 Discord (channel:1472013733122281753)
4. 同步到 Notion Daily Log (3019d604-3493-812c-b86f-e156ee866612)
变量用途必须LLM_API_URL自定义 LLM API 端点否LLM_API_KEY自定义 LLM API Key否LLM_MODEL自定义模型名否OPENCLAW_GATEWAY_TOKENOpenClaw Gateway token否GITHUB_TOKENGitHub token(有 Copilot 订阅时可用)否POLLINATIONS_API_KEYPollinations API Key否SUMMARY_MODE图文模式:text-only / auto-insert / ai-review否WHISPER_MODELB站 whisper 模型大小(默认 small)否FRAME_INTERVALB站关键帧间隔秒数(默认 30)否FRAME_TIME_OFFSET帧时间戳偏移秒数,避开转场(默认 5)否
无需任何 Key 也可运行:转录功能不需要 API Key;摘要功能会尝试 Pollinations 免费匿名调用。
has_transcript: falseREQUEST_DELAY_SECONDS (默认 3 秒)max_videos_per_channel旧脚本新 Skill硬编码频道列表配置文件驱动直接发送 Telegram输出 JSON,agent 处理单一 agent 专用所有 agent 可用逻辑耦合职责分离