npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

bili-summary

v1.1.0

Published

CLI tool to summarize Bilibili videos via subtitles or audio transcription using LLMs

Readme

Bilibili Video Summary Agent

npm

一个命令行工具(CLI):输入 B 站视频 BV 号或链接,自动获取字幕(或按需转录音频),用 LLM 生成「摘要 + 关键要点(带时间戳)」;可选自动发到评论区。

功能

  • 支持输入 BV 号或视频 URL(含分 P 参数)
  • 自动获取中文字幕(优先 AI 生成中文)
  • 无字幕时可选音频转录(需要 ffmpeg)
  • 生成适合评论区的纯文本总结(含时间戳)
  • 可选自动评论(需要 B 站 Cookie 参数)
  • 配置方式灵活:全部参数都可通过命令行传入(不依赖 .env

快速开始(推荐)

1) 安装

npm i -g bili-summary
# 或:npm install -g bili-summary

2) 直接使用

如果你不想创建 .env,直接把 Key 通过命令行传入:

bili-summary BV1uT4y1P7CX -k sk-xxxx

如果你更习惯用 npx:

npx bili-summary BV1uT4y1P7CX -k sk-xxxx

查看完整参数(永远以此为准):

bili-summary --help

常见用法

基本总结

bili-summary BV1uT4y1P7CX -k sk-xxxx

指定模型 / Base URL

bili-summary BV1uT4y1P7CX \
  -k sk-xxxx \
  -b https://api.openai.com/v1 \
  -m gpt-4o-mini

保存到文件

bili-summary BV1uT4y1P7CX -k sk-xxxx -o summary.txt

没有字幕时启用音频转录

需要本机安装 ffmpeg

bili-summary BV1uT4y1P7CX -k sk-xxxx --transcribe

指定转录模型:

bili-summary BV1uT4y1P7CX -k sk-xxxx --transcribe --audio-model doubao-seed-1-6-251015

强制转录(忽略字幕):

bili-summary BV1uT4y1P7CX -k sk-xxxx --force-transcribe

自动发评论(不需要写 .env)

bili-summary BV1uT4y1P7CX \
  -k sk-xxxx \
  --comment \
  --sessdata "SESSDATA_VALUE" \
  --jct "BILI_JCT_VALUE"

分 P

bili-summary "https://www.bilibili.com/video/BV1uT4y1P7CX?p=2" -k sk-xxxx

使用火山(Volcengine)语音识别转录

当设置了 --volc-app-key/--volc-access-key 时,会优先使用火山语音识别。

bili-summary BV1uT4y1P7CX \
  --transcribe \
  --volc-app-key "xxx" \
  --volc-access-key "yyy" \
  --volc-cluster "volc_auc_common"

参数速查(摘要)

bili-summary --help 输出为准。

  • -k, --key <key>:OpenAI API Key(或兼容服务)
  • -b, --base-url <url>:OpenAI Base URL
  • -m, --model <model>:用于总结的 Chat 模型
  • --audio-model <model>:音频转录模型
  • -o, --output <file>:保存结果到文件
  • --transcribe:无字幕时转录音频
  • --force-transcribe:强制转录(忽略字幕)
  • --comment:发布总结到评论区
  • --sessdata <sessdata>:B 站 Cookie(SESSDATA 值)
  • --jct <jct>:B 站 CSRF(bili_jct)
  • --volc-app-key <key> / --volc-access-key <key>:火山鉴权
  • --volc-cluster <cluster> / --volc-api-url <url>:火山资源与地址

常见问题

  • 提示没有字幕:使用 --transcribe--force-transcribe
  • 转录报错/无法切分:确认安装 ffmpeg,并且在 PATH 中可用。
  • 评论失败:需要同时提供 --sessdata--jct(或在环境变量里配置)。

配置(可选:使用 .env 作为默认值)

你可以完全不创建 .env;但如果你希望避免每次都输入参数,可以使用 .env

.env 放置位置:

  • 如果你在仓库里运行 pnpm dev / pnpm start,把 .env 放在仓库根目录(与 package.json 同级)。
  • 如果你全局安装后在任意目录运行 bili-summary / npx bili-summary,把 .env 放在你执行命令的当前目录(也就是 shell 的工作目录)。

创建示例:

cp .env.example .env

常用变量(示例,完整列表见 .env.example):

OPENAI_API_KEY=sk-xxxxxxxx
OPENAI_BASE_URL=https://api.openai.com/v1
OPENAI_CHAT_MODEL=gpt-4o-mini
OPENAI_AUDIO_MODEL=doubao-seed-1-6-251015

BILIBILI_SESSDATA=xxxx
BILIBILI_JCT=yyyy

VOLC_APP_KEY=xxx
VOLC_ACCESS_KEY=yyy
VOLC_CLUSTER=volc_auc_common
VOLC_API_URL=https://openspeech.bytedance.com/api/v1/asr

优先级:命令行参数 > 环境变量(.env / 系统环境)> 默认值。

开发(仓库贡献者)

pnpm install

# 直接跑 TS
pnpm dev -- BV1uT4y1P7CX -k sk-xxxx

# 构建后运行
pnpm build
pnpm start -- BV1uT4y1P7CX -k sk-xxxx

# 质量检查
pnpm format:check
pnpm typecheck
pnpm lint

License

MIT