转写本地文件时在“更新索引”阶段崩溃:'NoneType' object has no attribute 'get'
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 78/100
Research direction
Start with src/b2t/library.py line 34 and compare its metadata handling with index_existing_workspace at line 116; pipeline.py line 87 explains the local-file metadata shape. Reproduce with uv run bili2text tx ./local-video.mp4, then verify the local transcription reaches the indexing stage without the NoneType error and records the expected display-name fallback.
Written by the indexing model from the issue text.
Description
现象
运行 uv run bili2text tx ./local-video.mp4(本地文件)时,下载/转写本身正常完成,但在最后的“更新索引”阶段报错退出:
出错了: 'NoneType' object has no attribute 'get'
任务记录中失败在 indexing 阶段(register_transcript_result)。
根因
src/b2t/library.py 第 34 行:
title=result.metadata.get("download", {}).get("title") or result.source.display_name,
pipeline.py 第 87 行构造 metadata 时,本地文件(无下载步骤)下 download 键存在但值为 None:
"download": downloaded.metadata if downloaded else None,
因此 .get("download", {}) 返回的是 None(键存在、值不为空 dict),随后在 None 上调用 .get("title") 即崩溃。转写 B 站链接(有 download 信息)时不触发,所以本地文件路径 100% 复现。
修复建议
与 index_existing_workspace 中已有的正确写法保持一致(第 116 行用的是 (data.get("download") or {})):
title=(result.metadata.get("download") or {}).get("title") or result.source.display_name,
环境
- macOS (Apple Silicon), Python 3.12 (uv)
- bili2text 0.3.0(main 分支,2026-08 拉取)
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 243
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lanbinleo/bili2text
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
web版启动不了 Open
Difficulty 3/5 1-2 days Newbie friendliness 45/100
All issues in lanbinleo/bili2text
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100