SuperAPI AI Directory

bilibili-subtitles

Writing & research

View repository

Updated 10-15 22:15

About this skill

Bilibili Subtitle Download

Use scripts/download.py to call Bilibili public pages and player APIs to download existing subtitle tracks. Do not download videos or use speech recognition to fabricate subtitles.

Quick Start

Output defaults to the automatically located PPT Master projects/:

# UP 主全部公开视频
python3 skills/bilibili-subtitles/scripts/download.py --mid 351608062 --zip

# 空间 URL
python3 skills/bilibili-subtitles/scripts/download.py \
  --space-url "https://space.bilibili.com/351608062"

# 一个或多个视频
python3 skills/bilibili-subtitles/scripts/download.py \
  --bvid BV16c3u6XEni BV1wo3M64EdV
Prepared JSON video list

python3 skills/bilibili-subtitles/scripts/download.py
--video-list /path/to/videos.json


没有传入 `--cookie-file` 时,脚本生成 Bilibili 官方登录二维码并打印 `QR_CODE:` 路径。向用户展示该图片,等待用户在哔哩哔哩 App 确认;不要读取 Chrome Cookie、浏览器配置或会话存储。

如已有用户明确提供的 Netscape Cookie 文件,可传入:

```bash
python3 skills/bilibili-subtitles/scripts/download.py \
  --mid 351608062 \
  --cookie-file /path/to/cookies.txt

Output

Default project directory:

projects/bilibili-subtitles-<mid-or-bvid>/
  subtitles/                 # SRT 文件,文件名包含序号与 BV 号
  no-subtitle-videos.csv     # 没有公开字幕轨道的视频
  failed-videos.csv          # 请求或解析失败的视频(仅失败时生成)
  <project-name>.zip         # 仅传入 --zip 时生成

The script locates PPT Master in the following order:--ppt-master-root、PPT_MASTER_ROOT Environment variable, current working directory,hugo-skills of the sibling directory. If it cannot be located, stop and require explicit specification, do not fall back to hugo-skills/projects/。

Use --output to directly specify another project directory. Subtitles and lists are local project materials; do not write login cookies into the project or commit them to Git.

Execution Rules

  1. Prefer using --mid or --space-url to automatically paginate and fetch that UP host's video list.
  2. When login is required, use the script's official QR code flow; rerun after the QR code expires.
  3. Use the default concurrency 8; when rate-limited, lower --concurrency, do not add browser video tabs.
  4. Preserve the timeline and text returned by Bilibili; do not rewrite or summarize the subtitle body.
  5. After completion, verify the script summary, SRT file count, and failed-videos.csv; no subtitles does not count as a download failure.
  6. When rerunning on an existing project, reuse valid SRTs by default; pass only when the user explicitly requests a refresh --overwrite。

Dependencies

pip install -r skills/bilibili-subtitles/resources/requirements.txt

Except for QR code image generation, all other functionality uses only the Python standard library.