Bilibili Transcript v2.2
High-accuracy Bilibili video transcription with multi-language AI subtitle support.
Overview
This skill provides a complete transcription workflow for Bilibili videos:
- 1. Extract Video Metadata - Title, author, publish date, duration
- Smart Subtitle Detection - Priority: CC subtitles → AI subtitles (multi-language) → Whisper transcription
- Multi-language AI Subtitle Support - Auto-detects:
ai-zh, ai-en, ai-ja, ai-es, ai-ar, ai-pt, ai-ko, ai-de, INLINECODE8 - Browser Cookie Support - WSL Chromium or Windows Edge for member-only videos
- Formatted Output - Saves as structured TXT file with metadata + summary placeholder + full transcript
- Simplified Chinese - Automatically converts Traditional to Simplified Chinese
What's New in v2.2
- - ✅ Fixed cookie detection - Now uses browser config directory instead of SQLite file (avoids encoding errors)
- ✅ One-stop solution - CC subtitles → AI subtitles → Whisper transcription, all in one script
- ✅ Better WSL support - Automatically detects WSL Chromium and Windows Edge cookies
- ✅ Smart fallback - Seamlessly switches between subtitle sources without user intervention
What's New in v2.1
- - ✅ Improved cookie handling - Fixed UTF-8 encoding issues with snap Chromium
- ✅ Three-tier fallback - CC subtitles → AI subtitles → Whisper transcription
- ✅ Better error handling - Gracefully degrades when cookie sources fail
What's New in v2.0
- - ✅ Multi-language AI subtitles - Supports 9 languages: Chinese, English, Japanese, Spanish, Arabic, Portuguese, Korean, German, French
- ✅ WSL Chromium support - Better cookie extraction than Windows Edge
- ✅ Correct subtitle download - Uses
--write-subs --write-auto-subs combo - ✅ Language auto-detection - Automatically finds available AI subtitle language
AI Subtitle Language Codes
Bilibili uses ai- prefix for AI-generated subtitles:
| Code | Language | 语言 |
|---|
| INLINECODE11 | Chinese | 中文 |
| INLINECODE12 |
English | 英文 |
|
ai-ja | Japanese | 日文 |
|
ai-es | Spanish | 西班牙文 |
|
ai-ar | Arabic | 阿拉伯文 |
|
ai-pt | Portuguese | 葡萄牙文 |
|
ai-ko | Korean | 韩文 |
|
ai-de | German | 德文 |
|
ai-fr | French | 法文 |
Requirements
Hardware (Your Setup)
- - GPU: NVIDIA RTX 4070 Super (12GB VRAM) - ✅ Perfect for medium model
- WSL Memory: 16GB (configured)
- WSL CPU: 6 cores (configured)
Software
- -
yt-dlp - Video/audio download - INLINECODE21 - Audio processing
- INLINECODE22 - Speech-to-text (local, no API key)
- INLINECODE23 - Traditional to Simplified Chinese conversion (optional)
Browser (for AI subtitles)
- - WSL Chromium (recommended) - Log in to Bilibili in WSL
- Windows Edge - Alternative option
Workflow
Step 1: Run Transcription Script
CODEBLOCK0
Priority order:
- 1. CC Subtitles (manual) - Fastest, highest accuracy
- AI Subtitles (auto-generated) - Fast, good accuracy, multi-language
- Whisper Transcription - Slowest, ~95% accuracy, works for all videos
Step 2: Generate Detailed Summary
After the script completes, read the generated TXT file and:
- 1. Read the full transcript (第二部分)
- Generate a comprehensive summary (第一部分)
- Save the updated file
Step 3: Present to User
In Discord, post:
- - Brief summary in message
- Attach the TXT file for full content
Setup WSL Chromium Login
For best results with AI subtitles:
- 1. Start WSL Chromium:
CODEBLOCK1
- 2. Navigate to bilibili.com
- 3. Log in with your Bilibili account
- 4. Run the transcription script
The script will automatically use Chromium's cookies to access member-only AI subtitles.
Usage Examples
Example 1: Basic Transcription (Default Output)
CODEBLOCK2
Example 2: Custom Output Directory
CODEBLOCK3
Notes
Model Selection
- - Your config: RTX 4070 Super 12GB + 16GB RAM + 6 cores
- Default:
medium model (~95% accuracy, balanced speed) ✅ - Fallback: If GPU unavailable, automatically uses CPU (slower)
Accuracy Comparison
| Source | Accuracy | Speed | Best For |
|---|
| CC Subtitles | 100% | ⚡ Instant | All videos with manual subtitles |
| AI Subtitles (ai-zh) |
~90% | ⚡ Instant | Chinese videos |
| AI Subtitles (ai-en) | ~85% | ⚡ Instant | English videos |
| Whisper medium | ~95% | 🐢 Slow | No subtitle videos |
Default Output Directory
- - Location: INLINECODE25
- Created automatically on first run
- All transcript files organized in one place
File Naming
Output files are named:
[VideoTitle]_[BVID]_transcript.txt
- - Special characters (including Chinese punctuation) are replaced with underscores
- Title truncated to 50 characters
- Example: INLINECODE27
Subtitle Priority
The script tries subtitles in this order:
- 1. Manual CC subtitles (zh-CN, zh-TW, en, ja, etc.)
- AI subtitles (any available language: ai-zh, ai-en, ai-ja, etc.)
- Whisper voice transcription (fallback)
This ensures fastest processing while maintaining high accuracy.
Bilibili 字幕 v2.2
高精度B站视频转录,支持多语言AI字幕。
概述
本技能为B站视频提供完整的转录工作流程:
- 1. 提取视频元数据 - 标题、作者、发布日期、时长
- 智能字幕检测 - 优先级:CC字幕 → AI字幕(多语言)→ Whisper转录
- 多语言AI字幕支持 - 自动检测:ai-zh、ai-en、ai-ja、ai-es、ai-ar、ai-pt、ai-ko、ai-de、ai-fr
- 浏览器Cookie支持 - 支持WSL Chromium或Windows Edge获取会员专属视频
- 格式化输出 - 保存为结构化TXT文件,包含元数据+摘要占位符+完整转录
- 简体中文 - 自动将繁体中文转换为简体中文
v2.2 新增功能
- - ✅ 修复Cookie检测 - 现在使用浏览器配置目录而非SQLite文件(避免编码错误)
- ✅ 一站式解决方案 - CC字幕→AI字幕→Whisper转录,全部集成在一个脚本中
- ✅ 更好的WSL支持 - 自动检测WSL Chromium和Windows Edge的Cookie
- ✅ 智能降级 - 无需用户干预,无缝切换字幕来源
v2.1 新增功能
- - ✅ 改进Cookie处理 - 修复了snap版Chromium的UTF-8编码问题
- ✅ 三级降级机制 - CC字幕→AI字幕→Whisper转录
- ✅ 更好的错误处理 - Cookie来源失败时优雅降级
v2.0 新增功能
- - ✅ 多语言AI字幕 - 支持9种语言:中文、英文、日文、西班牙文、阿拉伯文、葡萄牙文、韩文、德文、法文
- ✅ WSL Chromium支持 - 比Windows Edge更好的Cookie提取
- ✅ 正确的字幕下载 - 使用--write-subs --write-auto-subs组合参数
- ✅ 语言自动检测 - 自动查找可用的AI字幕语言
AI字幕语言代码
B站使用ai-前缀表示AI生成的字幕:
英文 | 英文 |
| ai-ja | 日文 | 日文 |
| ai-es | 西班牙文 | 西班牙文 |
| ai-ar | 阿拉伯文 | 阿拉伯文 |
| ai-pt | 葡萄牙文 | 葡萄牙文 |
| ai-ko | 韩文 | 韩文 |
| ai-de | 德文 | 德文 |
| ai-fr | 法文 | 法文 |
系统要求
硬件(您的配置)
- - GPU:NVIDIA RTX 4070 Super(12GB显存)- ✅ 完美适配中等模型
- WSL内存:16GB(已配置)
- WSL CPU:6核(已配置)
软件
- - yt-dlp - 视频/音频下载
- ffmpeg - 音频处理
- whisper - 语音转文字(本地运行,无需API密钥)
- opencc - 繁体转简体中文转换(可选)
浏览器(用于AI字幕)
- - WSL Chromium(推荐)- 在WSL中登录B站
- Windows Edge - 备选方案
工作流程
步骤1:运行转录脚本
bash
./scripts/bilibili_transcript.sh https://www.bilibili.com/video/BVxxxxx
优先级顺序:
- 1. CC字幕(人工制作)- 最快,准确率最高
- AI字幕(自动生成)- 快速,准确率良好,支持多语言
- Whisper转录 - 最慢,约95%准确率,适用于所有视频
步骤2:生成详细摘要
脚本完成后,阅读生成的TXT文件并:
- 1. 阅读完整转录(第二部分)
- 生成全面摘要(第一部分)
- 保存更新后的文件
步骤3:呈现给用户
在Discord中发布:
- - 消息中附上简要摘要
- 附加TXT文件以提供完整内容
设置WSL Chromium登录
为获得最佳的AI字幕效果:
- 1. 启动WSL Chromium:
bash
chromium-browser &
- 2. 访问bilibili.com
- 3. 使用您的B站账号登录
- 4. 运行转录脚本
脚本将自动使用Chromium的Cookie访问会员专属AI字幕。
使用示例
示例1:基础转录(默认输出)
bash
./scripts/bilibili_transcript.sh https://www.bilibili.com/video/BV1Z1wJzgEAj/
输出:workspace/Bilibili transcript/[视频标题]BVxxxxxtranscript.txt
示例2:自定义输出目录
bash
./scripts/bilibili_transcript.sh https://www.bilibili.com/video/BV1Z1wJzgEAj/ ~/Documents
注意事项
模型选择
- - 您的配置:RTX 4070 Super 12GB + 16GB内存 + 6核
- 默认:medium模型(约95%准确率,速度均衡)✅
- 降级:如果GPU不可用,自动使用CPU(速度较慢)
准确率对比
| 来源 | 准确率 | 速度 | 最佳适用场景 |
|---|
| CC字幕 | 100% | ⚡ 即时 | 所有带人工字幕的视频 |
| AI字幕(ai-zh) |
~90% | ⚡ 即时 | 中文视频 |
| AI字幕(ai-en) | ~85% | ⚡ 即时 | 英文视频 |
| Whisper中等模型 | ~95% | 🐢 较慢 | 无字幕视频 |
默认输出目录
- - 位置:workspace/Bilibili transcript/
- 首次运行自动创建
- 所有转录文件集中存放
文件命名
输出文件命名格式:[视频标题]
[BVID]transcript.txt
- - 特殊字符(包括中文标点)替换为下划线
- 标题截取前50个字符
- 示例:股票分红是从左口袋掏右口袋吗BV1ddzUYTE27_transcript.txt
字幕优先级
脚本按以下顺序尝试字幕:
- 1. 人工CC字幕(zh-CN、zh-TW、en、ja等)
- AI字幕(任何可用语言:ai-zh、ai-en、ai-ja等)
- Whisper语音转录(降级方案)
这确保了在保持高准确率的同时实现最快的处理速度。