← 返回
数据分析 Key

Bili Summary

Download Bilibili videos, extract or transcribe subtitles, and generate AI-powered detailed summaries using Gemini 2.5 Flash.
下载B站视频,提取或转录字幕,并使用Gemini 2.5 Flash生成AI驱动的详细摘要。
lava-chen
数据分析 clawhub v1.0.0 1 版本 100000 Key: 需要
★ 0
Stars
📥 985
下载
💾 39
安装
1
版本
#latest

概述

bili-summary

Bilibili (B站) video download, subtitle extraction, and AI summarization tool.

When to Use

USE this skill when:

  • "download Bilibili video"
  • "extract B站 subtitles"
  • "summarize B站 video"
  • "B站视频总结"
  • "bilibili transcription"
  • Any Bilibili video URL

Features

  • Get video info (title, duration, uploader)
  • Download B站 video (video + audio)
  • Extract subtitles (B站 CC subtitles)
  • Audio extraction + Whisper transcription (when no subtitles)
  • Gemini AI detailed summary (chapters + key content + key insights + conclusion)

Prerequisites

1. Install Dependencies

# Using miniconda3 (recommended)
~/miniconda3/bin/pip install yt-dlp faster-whisper

# Or using system Python (may require sudo)
pip install yt-dlp faster-whisper

2. Get Gemini API Key

This skill uses Google Gemini 2.5 Flash for AI summarization.

Steps:

  1. Visit https://aistudio.google.com/app/apikey
  2. Sign in with your Google account
  3. Click "Create API Key"
  4. Copy the generated key

Pricing: Gemini 2.5 Flash has generous free tier (15 RPM, 1M TPM)

3. Set Environment Variable

# Add to your ~/.bashrc or ~/.zshrc for permanent setup
echo 'export GEMINI_API_KEY="your-api-key-here"' >> ~/.bashrc
source ~/.bashrc

# Or set temporarily for current session
export GEMINI_API_KEY="your-api-key-here"

Quick Start

Full Workflow (Recommended)

# Download audio, transcribe, and summarize in one command
uv run {baseDir}/scripts/bili-summary.py "https://www.bilibili.com/video/BV1xx411c7mu" --action summary

Other Actions

# Get video info only
uv run {baseDir}/scripts/bili-summary.py "URL" --action info

# Download subtitle (if available)
uv run {baseDir}/scripts/bili-summary.py "URL" --action subtitle

# Download and transcribe audio only
uv run {baseDir}/scripts/bili-summary.py "URL" --action transcribe

# Download full video
uv run {baseDir}/scripts/bili-summary.py "URL" --action video

Options

OptionDescriptionDefault
------------------------------
urlBilibili video URL (BV号或完整链接)required
--actionOperation: info/subtitle/transcribe/video/summarysummary
--outputOutput directory~/openclaw/workspace/coding-agent/temp/bili-summary

Output Files

Default output: ~/openclaw/workspace/coding-agent/temp/bili-summary/

temp/bili-summary/
├── audio.m4a       # Downloaded audio (deleted after summary)
├── subtitle.txt    # Transcribed text (deleted after summary)
└── summary.txt    # AI summary content

Workflow

summary (full workflow)

  1. Get video info - yt-dlp fetches title, duration, uploader
  2. Try B站 subtitles - Call Bilibili API for CC subtitles
  3. Fallback to Whisper - If no subtitles, download audio + faster-whisper (tiny model) transcription
  4. AI Summary - Call Gemini 2.5 Flash API for detailed summary

Time Estimate

StepTime
------------
Audio download~15s
Whisper transcription (tiny)~25s
Gemini summary~5s
Total~45s

API Configuration

Recommended API: Google Gemini

  • Model: gemini-2.5-flash
  • Endpoint: https://generativelanguage.googleapis.com/v1/models/gemini-2.5-flash:generateContent
  • Free Tier: 15 requests/minute, 1M tokens/minute
  • Sign up: https://aistudio.google.com/app/apikey

Alternative APIs (not implemented)

If you want to use other LLMs:

  • OpenAI GPT-4o - https://api.openai.com/v1/chat/completions
  • Anthropic Claude - https://api.anthropic.com/v1/messages
  • MiniMax - https://api.minimax.chat/v1/text/chatcompletion_v2

Note: Current implementation only supports Gemini. PRs welcome for other providers.

First-Time Setup Guide

Step 1: Install Python dependencies

# Check if miniconda3 exists
ls ~/miniconda3/bin/python

# Install dependencies
~/miniconda3/bin/pip install yt-dlp faster-whisper

# Or use uv
uv pip install yt-dlp faster-whisper

Step 2: Get API Key

  1. Go to https://aistudio.google.com/app/apikey
  2. Create new API key
  3. Copy the key

Step 3: Test the setup

# Set API key
export GEMINI_API_KEY="your-key-here"

# Test with a simple video
uv run {baseDir}/scripts/bili-summary.py "https://www.bilibili.com/video/BV1xx411c7mu" --action info

If you see JSON output with video title, duration, etc., you're ready!

Step 4: Run full summarization

uv run {baseDir}/scripts/bili-summary.py "https://www.bilibili.com/video/BV1xxx" --action summary

Troubleshooting

"No module named 'yt-dlp'"

~/miniconda3/bin/pip install yt-dlp faster-whisper

"GEMINI_API_KEY not found"

# Check if environment variable is set
echo $GEMINI_API_KEY

# Set it
export GEMINI_API_KEY="your-key"

"No subtitles available"

The skill automatically falls back to Whisper transcription. This may take longer but works for any video with audio.

"API rate limit exceeded"

Wait a minute and retry, or check your API quota at https://aistudio.google.com/app/apikey

Security Notes

  • ✅ API key is read from GEMINI_API_KEY environment variable only
  • ✅ No hardcoded API keys in source code
  • ✅ Temporary files stored in workspace temp directory
  • ⚠️ Audio/subtitle files are NOT auto-deleted (manual cleanup required)

File Structure

bili-summary/
├── SKILL.md              # This documentation
├── _meta.json            # ClawHub metadata (auto-generated)
└── scripts/
    └── bili-summary.py   # Main script

License

MIT License - Use at your own risk. Respect Bilibili's terms of service.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 12:44 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

data-analysis

A股量化 AkShare

mbpz
A股量化数据分析工具,基于AkShare库获取A股行情、财务数据、板块信息等。用于回答关于A股股票查询、行情数据、财务分析、选股等问题。
★ 162 📥 59,674
data-analysis

Excel / XLSX

ivangdavila
创建、检查和编辑 Microsoft Excel 工作簿及 XLSX 文件,支持可靠的公式、日期、类型、格式、重算及模板保留功能。
★ 366 📥 139,963
data-analysis

Data Analysis

ivangdavila
{"answer":"数据分析与可视化。查询数据库、生成报告、自动化电子表格,将原始数据转化为清晰可行的见解。适用于:(1) 您……"}
★ 198 📥 64,859