← Back to Skills Marketplace
epantrip

Bilibili Video Downloader

by epantrip · GitHub ↗ · v1.1.0 · MIT-0
cross-platform ⚠ suspicious
221
Downloads
1
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install bilibili-video-downloader
Description
哔哩哔哩视频搜索与下载工具。使用场景: - 根据关键词搜索B站视频 - 下载B站视频(支持多种清晰度) - 获取视频详情、弹幕、评论 - 批量下载UP主视频 - "帮我下载B站上的XX视频" - "搜索B站关于XX的视频" - "把B站这个视频下载下来" - "获取B站视频弹幕
README (SKILL.md)

Bilibili Video Downloader

基于 yt-dlp 封装的哔哩哔哩视频下载工具。

快速参考

脚本 用途
install-check.ps1 检查依赖是否安装 (Windows)
install-check.sh 检查依赖是否安装 (macOS/Linux)
search.ps1/sh \x3C关键词> [数量] 搜索B站视频
download.ps1/sh \x3CURL> [清晰度] 下载单个视频
video-info.ps1/sh \x3CURL> 获取视频详情

快速开始

Windows

cd scripts\

# 1. 检查依赖
.\install-check.ps1

# 2. 搜索视频
.\search.ps1 -Keyword "Python教程" -Limit 10

# 3. 下载视频(默认最高清晰度)
.\download.ps1 -Url "https://www.bilibili.com/video/BV1xx411c7mD"

# 4. 指定清晰度下载
.\download.ps1 -Url "https://www.bilibili.com/video/BV1xx411c7mD" -Quality 1080

macOS / Linux

cd scripts/

# 1. 检查依赖
./install-check.sh

# 2. 搜索视频
./search.sh "Python教程" 10

# 3. 下载视频
./download.sh "https://www.bilibili.com/video/BV1xx411c7mD"

搜索视频

Windows

.\search.ps1 -Keyword "关键词" -Limit 20

# 示例
.\search.ps1 -Keyword "深度学习" -Limit 20
.\search.ps1 -Keyword "考研数学" -Limit 10

macOS / Linux

./search.sh "关键词" [结果数量]

# 示例
./search.sh "深度学习" 20
./search.sh "考研数学" 10

输出格式:

标题 | UP主 | 播放量 | BV号 | 链接

下载视频

单视频下载

Windows:

.\download.ps1 -Url "\x3CURL>" -Quality \x3C清晰度> -OutputDir \x3C目录>

# 清晰度选项: 360, 480, 720, 1080, 1080p+, 4K (默认best)

.\download.ps1 -Url "https://www.bilibili.com/video/BV1xx411c7mD"
.\download.ps1 -Url "https://www.bilibili.com/video/BV1xx411c7mD" -Quality 1080 -OutputDir ".\my-videos"

macOS / Linux:

./download.sh \x3CURL> [清晰度] [输出目录]

./download.sh "https://www.bilibili.com/video/BV1xx411c7mD"
./download.sh "https://www.bilibili.com/video/BV1xx411c7mD" 1080 ./downloads

批量下载

创建包含URL的文件(每行一个):

https://www.bilibili.com/video/BV1xx411c7mD
https://www.bilibili.com/video/BV1yy411c7nE
https://www.bilibili.com/video/BV1zz411c7oF

然后执行(macOS/Linux):

./download-batch.sh urls.txt 1080 ./downloads

获取视频信息

Windows:

.\video-info.ps1 -Url "https://www.bilibili.com/video/BV1xx411c7mD"

macOS / Linux:

./video-info.sh "https://www.bilibili.com/video/BV1xx411c7mD"

获取UP主视频列表 (macOS/Linux)

# 获取UP主视频列表
./up-videos.sh "UID" 50

# 示例:获取UID为208259的UP主前30个视频
./up-videos.sh 208259 30

如何获取UID:打开UP主主页,URL中的数字就是UID,如 space.bilibili.com/208259

获取评论 (macOS/Linux)

./comments.sh "https://www.bilibili.com/video/BV1xx411c7mD" 100

下载弹幕 (macOS/Linux)

./danmaku.sh "https://www.bilibili.com/video/BV1xx411c7mD" danmaku.xml

依赖要求

  • Python 3.8+
  • yt-dlp
  • ffmpeg (用于合并音视频)

安装依赖

Windows

# 安装 Python
winget install Python.Python.3.12

# 安装 yt-dlp
pip install yt-dlp

# 安装 ffmpeg
winget install Gyan.FFmpeg

macOS

# 安装 Python 和 yt-dlp
brew install python yt-dlp ffmpeg

# 或
pip3 install yt-dlp

Ubuntu / Debian

sudo apt update
sudo apt install python3 python3-pip ffmpeg
pip3 install yt-dlp

注意事项

  • 下载的视频仅供个人学习使用,请遵守版权法规
  • 部分视频需要登录才能下载高清版本
  • 大会员专享视频需要配置cookies
  • 建议配置cookies以获得最佳下载体验

配置Cookies(可选)

如需下载大会员专享或高清视频,配置cookies:

  1. 浏览器登录B站
  2. 使用浏览器扩展导出cookies为txt格式(如 "Get cookies.txt")
  3. 保存为 cookies.txt 放在脚本目录

执行环境权限说明

⚠️ 重要提示:本 Skill 的执行环境有安全限制,可能无法直接写入文件。

功能 状态 说明
获取视频信息 ✅ 可用 可以获取标题、播放量、清晰度等
生成下载命令 ✅ 可用 可以生成 yt-dlp 命令
自动下载文件 ⚠️ 受限 取决于执行环境权限

解决方案

方案 A:手动执行(推荐) AI 提供下载命令,你自己复制粘贴运行:

yt-dlp "https://www.bilibili.com/video/BV18NzvB5EZu" -o "$HOME\Downloads\%(title)s.%(ext)s"

方案 B:提升权限(可选) 如需 AI 直接下载文件,请参考 PERMISSIONS.md 配置权限。

工作原理

本Skill基于 yt-dlp 实现:

  • 视频搜索:使用 yt-dlp 的搜索功能
  • 视频下载:自动选择最佳音视频流并合并
  • 信息获取:解析B站API返回的元数据
  • 弹幕/评论:调用B站公开API获取
Usage Guidance
This package appears to do exactly what it says: it wraps yt-dlp and uses Bilibili APIs to search and download videos. Before using it: 1) Inspect the scripts locally (they are plain shell/Python and readable). 2) Do NOT blindly follow the PERMISSIONS.md steps to grant Everyone:F or permanently run the agent as administrator — instead create a single dedicated low-privilege directory for downloads and give only your user account access. 3) Treat cookies.txt as a secret (contains session tokens); place it only in a controlled folder and delete it when done. 4) If you run install-check.sh, review it first — it may run pip3 install yt-dlp (expected) but installing packages should be a conscious choice. 5) Prefer the recommended 'manual execution' workflow (copy the generated yt-dlp commands and run them yourself) unless you explicitly trust the environment and are comfortable with temporary, scoped permission changes. If you want a safer assessment, provide the exact environment (OS, how OpenClaw runs commands) so I can point out any additional platform-specific risks.
Capability Analysis
Type: OpenClaw Skill Name: bilibili-video-downloader Version: 1.1.0 The skill bundle is a functional Bilibili video downloader based on yt-dlp, but it contains significant shell injection vulnerabilities due to a lack of input sanitization. Specifically, in scripts/bilibili.sh and scripts/search.sh, user-provided keywords and URLs are passed directly into shell commands and Python heredocs (e.g., the 'keyword' variable in yt-dlp search), which could allow a prompt-injection attack to execute arbitrary commands on the host system. While the intent appears to be a legitimate utility and includes helpful security documentation in PERMISSIONS.md, the underlying code structure presents a high risk of exploitation in an agentic environment.
Capability Assessment
Purpose & Capability
Name/description align with the included files and runtime behavior: scripts call yt-dlp, ffmpeg and Bilibili APIs to search, fetch metadata, download video, comments and danmaku. No unrelated network endpoints, binaries or credentials are requested.
Instruction Scope
SKILL.md and scripts limit activity to searching, metadata retrieval, downloading and use of cookies for authenticated downloads. The skill explicitly warns the execution environment may not permit file writes and recommends manual execution. However documentation (PERMISSIONS.md / INSTALL.md) also contains step-by-step guidance for changing system execution policy and granting broad write permissions to directories — these expand the operational scope if followed.
Install Mechanism
There is no external installer; this is instruction+script based (lowest install risk). A helper script (install-check.sh) will attempt to install yt-dlp via pip3 if not present, which is expected but an action that executes package installs on the user's system and should be reviewed before running.
Credentials
The skill does not request environment variables or external credentials in metadata. It does instruct users to create a cookies.txt for authenticated downloads — which is appropriate for the claimed function but is sensitive data (SESSDATA, bili_jct). The scripts will read cookies.txt from the script directory if present; users should not place other secrets there.
Persistence & Privilege
The skill itself does not declare always: true or persistently modify other skills. However PERMISSIONS.md recommends potentially risky actions (running the agent as administrator, changing PowerShell execution policy, and using icacls to grant Everyone:F on a directory). Those are broad privilege escalations that are unnecessary for basic use and present real security risk if followed.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install bilibili-video-downloader
  3. After installation, invoke the skill by name or use /bilibili-video-downloader
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.1.0
**Major update: Script-based, multi-platform Bilibili downloader with search, video info, danmaku/comments, and cookie support, using yt-dlp.** - Migrated from Python API to cross-platform shell/PowerShell scripts wrapping `yt-dlp` for video downloads. - Added keyword-based Bilibili video search (`search.sh`/`search.ps1`). - Supports single, batch, and UP主 (creator) video downloads with quality selection. - Added scripts for fetching video info, comments, danmaku, and playlist/UP主 video listing. - Introduced cookie configuration for restricted/high-quality videos. - Provided detailed usage, dependency installation, and security notes in documentation.
Metadata
Slug bilibili-video-downloader
Version 1.1.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Bilibili Video Downloader?

哔哩哔哩视频搜索与下载工具。使用场景: - 根据关键词搜索B站视频 - 下载B站视频(支持多种清晰度) - 获取视频详情、弹幕、评论 - 批量下载UP主视频 - "帮我下载B站上的XX视频" - "搜索B站关于XX的视频" - "把B站这个视频下载下来" - "获取B站视频弹幕. It is an AI Agent Skill for Claude Code / OpenClaw, with 221 downloads so far.

How do I install Bilibili Video Downloader?

Run "/install bilibili-video-downloader" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Bilibili Video Downloader free?

Yes, Bilibili Video Downloader is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Bilibili Video Downloader support?

Bilibili Video Downloader is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Bilibili Video Downloader?

It is built and maintained by epantrip (@epantrip); the current version is v1.1.0.

💬 Comments