f26d4d8f7f
- Multi-source content aggregation (Bilibili/YouTube/Zhihu) - Smart inbox management with AI quality scoring - Long video chunking analysis (30min+ auto-segmentation) - Topic-based organization - Git auto-sync to Obsidian - Template system with Jinja2 and fallback rendering - CLI commands: subscribe, inbox, process, skip, status, search - Comprehensive test suite with unit and integration tests - Documentation: README.md and SKILL.md Checkpoint 7-8 completed by Agent E
Obsidian KB Skill
多源内容知识库维护系统,支持 Bilibili、YouTube、知乎等平台的内容聚合,智能分类,以及长视频分段分析。
功能特性
- 多源内容聚合: 支持 Bilibili、YouTube、知乎等平台
- 智能收件箱: AI 质量评分,自动分类
- 长视频分段分析: 30分钟+ 视频自动分段处理
- 主题组织: 基于标签的自动主题归类
- Git 自动同步: 自动同步到 Obsidian 知识库
- CLI 命令: 完整的命令行接口
快速开始
安装
# 克隆项目
git clone <repository-url>
cd obsidian-kb
# 安装依赖
pip install -r requirements.txt
# 配置
cp config.example.yaml config.yaml
# 编辑 config.yaml,设置 API key 等
配置
创建 config.yaml:
ai:
provider: openai
model: gpt-4
api_key: your-api-key-here # 或设置 OPENAI_API_KEY 环境变量
storage:
inbox_dir: inbox
topics_dir: topics
data_dir: data
git:
enabled: true
vault_path: ~/ObsidianVault # Obsidian 知识库路径
remote: origin
branch: main
chunking:
enabled: true
chunk_duration_seconds: 900 # 15 分钟分段
long_video_threshold: 1800 # 30 分钟以上视为长视频
sources:
bilibili:
enabled: true
cookie: your-bilibili-cookie # 可选,用于获取字幕
基本使用
# 订阅 Bilibili 收藏夹
/kb-subscribe bilibili:fav:12345678
# 查看收件箱
/kb-inbox
# 处理所有内容
/kb-process --all
# 处理指定内容
/kb-process BV1xx411c7mD
# 跳过内容
/kb-skip BV1xx411c7mD
# 查看状态
/kb-status
# 搜索知识库
/kb-search python tutorial
项目结构
obsidian-kb/
├── src/
│ ├── __init__.py
│ ├── models.py # 数据模型
│ ├── config.py # 配置管理
│ ├── storage.py # 存储管理
│ ├── template_renderer.py # 模板渲染
│ ├── content_chunker.py # 内容分块
│ ├── pipeline.py # 处理管道
│ ├── cli.py # 命令行接口
│ ├── git_sync.py # Git 同步
│ └── sources/
│ ├── __init__.py
│ ├── base.py # 适配器基类
│ └── bilibili.py # Bilibili 适配器
├── templates/
│ ├── light_video.md # 轻量视频模板
│ ├── tutorial_video.md # 教程视频模板
│ ├── article.md # 文章模板
│ └── topic_index.md # 主题索引模板
├── tests/ # 测试
├── config.yaml # 配置文件
└── README.md
模板系统
根据内容类型和时长自动选择模板:
- 轻量视频 (
< 30分钟):light_video.md - 教程视频 (
≥ 30分钟):tutorial_video.md- 包含详细分段、前置知识、常见坑点 - 文章:
article.md
长视频分段策略
| 时长 | 策略 | 分段数 |
|---|---|---|
| < 10分钟 | 直接处理 | 1 |
| 10-30分钟 | 截断处理 | 1 |
| 30-60分钟 | 两段式 | 2 |
| 60分钟+ | 多段式 | 每15分钟一段 |
开发
# 运行测试
pytest tests/
# 运行特定测试
pytest tests/test_models.py
# 覆盖率报告
pytest --cov=src tests/
许可证
MIT License