agentleFS
moonmoonCLmoonmoonCL/bilibili-transcript/skills/SKILL.md

bilibili-transcript

Skill4 starsChanged 2 months agoMITView on GitHub

Fetch transcripts from Bilibili videos via yt-dlp (primary, using browser cookies) or Chrome DevTools Protocol (fallback). Supports Chinese/English/AI subtitle tracks; the video must have subtitles. Use when you need to get subtitles/transcripts from Bilibili videos.

  • Installs packages

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. ChenSheg/knowledge-from-literature-and-bilibili★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repositoryOne other file it gives its agents.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Verify the port is open: curl -s http://localhost:9222/json/version

    line 103
  2. Distinctive:

    Keep that Chrome window open and logged into bilibili.com, then run the skill again.

    line 105

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Bilibili Transcript

Fetch Bilibili video transcripts with dual strategy: yt-dlp (primary, reads browser cookies) → Chrome CDP (fallback).

Setup

The primary strategy (yt-dlp) needs no Node dependencies. Install the script dependencies once only if you need the Chrome CDP fallback:

cd {baseDir} && npm install

Prerequisites

  • Node.js 22+
  • yt-dlp: brew install yt-dlp (for the primary method)
  • A browser logged into bilibili.com — yt-dlp reads cookies with --cookies-from-browser. If cookie reading fails, quit the browser first (a running Chrome locks / encrypts its cookie database).
  • Chrome with remote debugging and a B站 login (fallback method only)

Usage

{baseDir}/transcript.js <bvid-or-url>

Accepts BVID or full URL:

  • BV13nwdzPEoR
  • https://www.bilibili.com/video/BV13nwdzPEoR/

Strategy

1. Try yt-dlp (reads browser cookies; picks a zh / en / AI subtitle track)
   ↓ on failure
2. Fall back to Chrome CDP (requires Chrome on :9222)

On failure the script prints the real cause instead of a generic error: yt-dlp not installed, HTTP 412 (anti-scraping / not logged in), cookie read failure, no matching subtitle language, or the video needs a login.

Configuration (environment variables)

  • BILIBILI_COOKIES_FROM_BROWSER — default chrome (e.g. firefox, edge)
  • BILIBILI_SUBTITLE_LANGS — default zh-Hans,zh-CN,zh,zh-TW,ai-zh,en
  • BILIBILI_CDP_URL — default http://localhost:9222
  • BILIBILI_YTDLP_TIMEOUT_MS — default 60000

Output

Timestamped transcript entries:

# Video Title

[0:00] 字幕文本第一行
[0:15] 字幕文本第二行
[1:23] 字幕文本第三行

Limitations

  • The video must actually have subtitles. Human Chinese/English subtitles and AI (ai-zh) subtitles are all supported; choose tracks with BILIBILI_SUBTITLE_LANGS.
  • Bilibili's subtitle API usually requires a login, so unauthenticated runs may hit HTTP 412.
  • Check availability: yt-dlp --list-subs <url>.

Chrome CDP Fallback (optional)

Triggered automatically when yt-dlp fails. Requires:

  1. puppeteer-core installed in the skill directory: cd {baseDir} && npm install
  2. Chrome running with remote debugging on port 9222 and a dedicated --user-data-dir — Chrome 136+ ignores --remote-debugging-port when the default profile is used.
  3. That same Chrome logged into bilibili.com (some subtitles need a login and the API returns need_login_subtitle).

Start Chrome:

# macOS
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
  --remote-debugging-port=9222 --user-data-dir="$HOME/.chrome-cdp"
# Linux
google-chrome --remote-debugging-port=9222 --user-data-dir="$HOME/.chrome-cdp"
# Windows
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir="%USERPROFILE%\.chrome-cdp"

Verify the port is open: curl -s http://localhost:9222/json/version

Keep that Chrome window open and logged into bilibili.com, then run the skill again. See README.md for detailed setup and troubleshooting.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.