Video Doc Generator
一个能够管理视频链接,调用视频解析 API 读取和解析视频,并将视频内容转换为专业文档和分析说明的 Python 包。
功能特性
- 视频链接管理: 支持添加、删除、查询和批量管理视频链接
- 视频解析: 调用视频解析 API 提取视频元数据和转录文本
- 文档生成: 将视频内容转换为专业的 Markdown 文档
- 内容分析: 自动生成视频分析说明和关键要点
- 命令行工具: 提供便捷的 CLI 接口
安装
基本安装
pip install video-doc-generator
从源码安装
git clone https://github.com/flashpoint493/video-doc-generator.git
cd video-doc-generator
pip install -e ".[dev]"
快速开始
安装
pip install video-doc-generator
命令行使用(推荐)
安装后,你可以直接使用 video-doc 命令:
# 查看帮助
video-doc --help
# 添加视频链接
video-doc add "https://www.youtube.com/watch?v=example" --title "示例视频"
# 列出所有视频
video-doc list
# 解析视频并生成文档(需要配置 API Key)
export VIDEO_PARSER_API_KEY="your-bigpt-api-key"
video-doc parse "https://www.youtube.com/watch?v=example" --output-dir docs
# 处理所有已添加的视频
video-doc process-all --output-dir docs
Python 代码使用
from video_doc_generator import VideoManager, VideoParser, DocumentGenerator
# 1. 管理视频链接
manager = VideoManager()
manager.add("https://www.youtube.com/watch?v=example", title="示例视频")
# 2. 解析视频(使用 BigGPT API,推荐 GET 方法)
parser = VideoParser(api_key="your-api-key", use_get_method=True)
result = parser.parse("https://www.youtube.com/watch?v=example")
# 3. 生成文档
generator = DocumentGenerator(output_dir="docs")
filepath = generator.generate_markdown(result)
print(f"文档已生成: {filepath}")
配置
API Key 配置
方式 1: 环境变量(推荐)
# BigGPT API Key(推荐使用 BigGPT)
export VIDEO_PARSER_API_KEY="your-bigpt-api-key"
# 或者
export BIGGPT_API_KEY="your-bigpt-api-key"
方式 2: 命令行参数
video-doc parse "https://www.youtube.com/watch?v=example" \
--api-key "your-bigpt-api-key" \
--output-dir docs
方式 3: 代码中指定
parser = VideoParser(api_key="your-bigpt-api-key", use_get_method=True)
获取 BigGPT API Key
- 访问 BigGPT
- 注册/登录账号
- 获取 API Token
- 推荐使用 GET 方法(更稳定)
注意: 当前版本主要支持 BigGPT API。推荐使用 GET 方法。请访问 BigGPT 官网 了解最新的 API 定价和使用政策。
项目结构
video-doc-generator/
├── src/
│ └── video_doc_generator/
│ ├── __init__.py
│ ├── manager.py # 视频链接管理
│ ├── parser.py # 视频解析
│ ├── generator.py # 文档生成
│ └── cli.py # 命令行接口
├── tests/ # 测试文件
├── docs/ # 生成的文档
├── pyproject.toml
└── README.md
核心模块
VideoManager
视频链接管理器,提供视频链接的增删改查功能。
from video_doc_generator import VideoManager
manager = VideoManager()
manager.add("https://www.youtube.com/watch?v=example")
videos = manager.list_all()
VideoParser
视频解析器,调用视频解析 API 获取视频元数据和转录文本。支持多个 API 提供商。
from video_doc_generator import VideoParser
# 使用默认提供商(BigGPT)
parser = VideoParser(api_key="your-api-key", use_get_method=True)
result = parser.parse("https://www.youtube.com/watch?v=example")
# 指定提供商名称
parser = VideoParser(api_key="your-api-key", provider_name="bigpt", use_get_method=True)
result = parser.parse("https://www.bilibili.com/video/BV1xxx")
# 使用自定义提供商(高级用法)
from video_doc_generator.providers.bigpt import BigGPTProvider
provider = BigGPTProvider(api_key="your-api-key", use_get_method=True)
parser = VideoParser(provider=provider)
result = parser.parse("https://www.youtube.com/watch?v=example")
DocumentGenerator
文档生成器,将视频内容转换为 Markdown 文档。
from video_doc_generator import DocumentGenerator
generator = DocumentGenerator(output_dir="docs")
filepath = generator.generate_markdown(parse_result)
开发
设置开发环境
# 克隆仓库
git clone https://github.com/flashpoint493/video-doc-generator.git
cd video-doc-generator
# 安装开发依赖
pip install -e ".[dev]"
# 安装 pre-commit hooks
pre-commit install
运行测试
# 运行所有测试
pytest
# 运行测试并生成覆盖率报告
pytest --cov=src --cov-report=html
代码质量
# 格式化代码
ruff format .
# 检查代码
ruff check .
# 类型检查
mypy .
详细文档
使用场景
- 教育内容整理: 将教学视频转换为文档,便于学习和复习
- 会议记录转换: 将会议视频转换为会议纪要
- 视频内容分析: 分析视频内容,提取关键信息
- 知识库构建: 批量处理视频,构建知识库
贡献
欢迎贡献!请先阅读 CONTRIBUTING.md。
- Fork 仓库
- 创建功能分支 (
git checkout -b feat/amazing-feature) - 提交更改 (
git commit -m 'feat: add amazing feature') - 推送到分支 (
git push origin feat/amazing-feature) - 开启 Pull Request
许可证
本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。
联系方式
- GitHub: @flashpoint493
- Issues: GitHub Issues
Made with ❤️ by Auto Project Team
Metadata
Release files for video-doc-generator 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| video_doc_generator-0.1.2.tar.gz | 17.0 kB | Without provenance | Details for video_doc_generator-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| video_doc_generator-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for video_doc_generator-0.1.2-py3-none-any.whl |
Total release size: 34.3 kB
Release files / video_doc_generator-0.1.2.tar.gz
| Download URL | video_doc_generator-0.1.2.tar.gz |
|---|---|
| Size | 17.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cbfd44d875bebace867bafd5129b137c8def6f63947592d04d14981100203313
|
|
BLAKE2b-256 checksum How to use checksums |
0aba9e273ef7a4033d31a2a7e10f61decef4491ad33b02c544cfe1dc3bf714b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.0
|
Release files / video_doc_generator-0.1.2-py3-none-any.whl
| Download URL | video_doc_generator-0.1.2-py3-none-any.whl |
|---|---|
| Size | 17.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
29aeeab3479ef6bf732dada5fa2cb12a8c32cb9f2ebabf33a24c763a0168a4f0
|
|
BLAKE2b-256 checksum How to use checksums |
c35392cec076542a9424c31dda9006a1898b0fd879a85862f0e5cf783c2b5a38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.0
|
Security for video-doc-generator 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.