Skip to content

fix: 修复 B 站下载与任务状态文件异常#340

Open
iorireal wants to merge 1 commit into
JefferyHcool:masterfrom
iorireal:codex/bilibili-412-status-fix
Open

fix: 修复 B 站下载与任务状态文件异常#340
iorireal wants to merge 1 commit into
JefferyHcool:masterfrom
iorireal:codex/bilibili-412-status-fix

Conversation

@iorireal
Copy link
Copy Markdown

@iorireal iorireal commented May 6, 2026

Summary

This is a focused replacement for #332. It keeps the PR scoped to the user-facing backend failures from #330 and removes the unrelated agent/Claude docs, AI workflow files, frontend lint cleanup, Mermaid work, and large lockfile churn from the previous PR.

Changes

  • Upgrade yt-dlp from 2025.3.31 to 2026.3.17 to pick up newer Bilibili extractor/Wbi handling.
  • Route Bilibili and YouTube downloader logs through the project logger via get_logger(__name__).
  • Apply shared Bilibili yt-dlp options for audio, video, and subtitle extraction: browser-like headers, extractor retries, and cookiefile support.
  • Keep CookieConfigManager support and add a cookies.txt fallback lookup path for local/backend/Docker usage.
  • Add skip_download support to BilibiliDownloader.download() so subtitle-first flows can extract metadata without downloading media.
  • Harden task status polling against empty or corrupt status JSON files, including the case where the final result file already exists.
  • Simplify status writes to avoid the Windows temp-file replace race that can leave an empty status file.
  • Ignore local AI agent files and local cookies.txt files so future PRs do not accidentally include them.
  • Add regression tests for empty/corrupt status files and Bilibili skip_download interface compatibility.

Fixes #330.

Validation

  • python -m py_compile backend/app/downloaders/bilibili_downloader.py backend/app/downloaders/youtube_downloader.py backend/app/routers/note.py backend/app/services/note.py backend/tests/test_note_status_resilience.py
  • cd backend && python -m pytest tests/test_note_status_resilience.py tests/test_note_helper.py -q -> 5 passed
  • cd backend && python -m pytest tests/ -q -> 14 passed, 1 failed in tests/test_task_serial_executor.py::TestTaskSerialExecutor::test_executor_runs_tasks_one_by_one; this is the existing origin/master baseline mismatch where SerialTaskExecutor is currently an alias for ConcurrentTaskExecutor, not introduced by this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: B 站下载 412 错误 + 日志丢失 + 状态文件竞态

1 participant