← 返回 Skills 市场
epantrip

Bilibili Video Downloader

作者 epantrip · GitHub ↗ · v1.1.0 · MIT-0
cross-platform ⚠ suspicious
221
总下载
1
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install bilibili-video-downloader
功能描述
哔哩哔哩视频搜索与下载工具。使用场景: - 根据关键词搜索B站视频 - 下载B站视频(支持多种清晰度) - 获取视频详情、弹幕、评论 - 批量下载UP主视频 - "帮我下载B站上的XX视频" - "搜索B站关于XX的视频" - "把B站这个视频下载下来" - "获取B站视频弹幕
使用说明 (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获取
安全使用建议
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.
功能分析
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.
能力评估
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.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install bilibili-video-downloader
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /bilibili-video-downloader 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
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.
元数据
Slug bilibili-video-downloader
版本 1.1.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Bilibili Video Downloader 是什么?

哔哩哔哩视频搜索与下载工具。使用场景: - 根据关键词搜索B站视频 - 下载B站视频(支持多种清晰度) - 获取视频详情、弹幕、评论 - 批量下载UP主视频 - "帮我下载B站上的XX视频" - "搜索B站关于XX的视频" - "把B站这个视频下载下来" - "获取B站视频弹幕. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 221 次。

如何安装 Bilibili Video Downloader?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install bilibili-video-downloader」即可一键安装,无需额外配置。

Bilibili Video Downloader 是免费的吗?

是的,Bilibili Video Downloader 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Bilibili Video Downloader 支持哪些平台?

Bilibili Video Downloader 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Bilibili Video Downloader?

由 epantrip(@epantrip)开发并维护,当前版本 v1.1.0。

💬 留言讨论