bilibili-video-crawler
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "bilibili-video-crawler" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-d42460a15653913d1759be5ebb0bcf3300e2f0a1becea487eeffff84ec16e6b5. Verify the upstream source and version against https://skillhub.cn/skills/user_34656363/bilibili-video-crawler before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Skill for crawling and downloading Bilibili videos, supporting search-based, UP creator space, favorites, or individual video downloads. Implementation details include WBI signature, DASH audio/video separation, and merging with ffmpeg.
Introduction source: third_party · user_34656363 · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Inputs and outputs
- Translation pending; see source documentation.
- Software, accounts and paid services
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: bilibili-video-crawler
description: "爬取和下载B站视频 — 支持搜索、UP主空间、收藏夹、单个视频下载。内置WBI签名、DASH音视频分离、ffmpeg合并。"
metadata:
hermes:
emoji: 🎬
requires:
bins: [ffmpeg, python3]B站视频爬取技能
概述
自动化爬取B站视频内容,支持多种场景:
- 关键词搜索视频
- UP主空间批量获取
- 收藏夹/合集解析
- 单个视频下载
前置条件
- Cookie配置 — 在脚本中设置有效的
COOKIE_STR,必须包含SESSDATA和bili_jct - 安装ffmpeg — 用于合并DASH分离的音视频流
- 安装requests —
pip install requests
核心功能
1. 搜索视频
# 搜索关键词
search_videos("lidar360教程", page=1, order="totalrank")
- 使用WBI签名请求搜索API
- 支持排序(总排名、最多点击、最新发布)
- 自动过滤非视频结果
2. UP主空间爬取
# 获取UP主视频列表
get_space_videos(uid=649019192, pn=1, ps=30)
- 自动获取UP主所有视频
- 支持分页浏览
- 提取标题、BV号、播放量、时长
3. 单个视频下载
# 下载单个视频
download_video("BV1xxxxxx", qn=80)
- 自动获取DASH音视频流
- 进度显示
- ffmpeg合并为MP4
- 自动清理临时文件
关键技术实现
WBI签名
B站API防爬机制:
MIXIN_ENC_TAB = [46,47,18,2,53,8,23,32,15,50,10,31,58,3,45,35,27,43,5,49,33,9,42,19,29,28,14,39,12,38,41,13,37,48,7,16,24,55,40,61,26,17,0,1,60,51,30,4,22,25,34,56,63,11,36,59,2,21,20,44,62,18,52]
def get_wbi_key():
# 从nav接口获取img_key和sub_key
# 拼接并按MIXIN_ENC_TAB重排
# 返回前32位作为mixin_key
pass
def sign_params(params):
# 添加wts时间戳
# 参数按key排序
# 去除特殊字符
# MD5拼接mixin_key
pass
DASH流处理
B站视频采用DASH分离传输:
- 请求
/x/player/playurl获取音视频流URL - 分别下载
.m4s文件 - 使用ffmpeg合并:
ffmpeg -i video.m4s -i audio.m4s -c copy output.mp4
文件名处理
def clean_filename(name):
# 移除Windows非法字符
# 截断至80字符
return cleaned_name
Pitfalls
- Cookie失效 — SESSDATA通常7天过期,过期后需重新获取
- WBI签名超时 — 接口有频率限制,建议请求间隔1.5秒
- 大文件下载 — 高清视频可能数GB,注意磁盘空间
- 网络波动 — 下载大文件时可能中断,需要重试机制
- 版权限制 — 部分视频有地域或会员限制
- WBI参数排序陷阱 — 当
aid值极大时,aid参与签名字典排序会导致-400错误。请求播放地址时必须同时传bvid+cid+aid。详见media/bilibili-downloader技能的 Pitfalls 章节。 - 搜索接口签名差异 —
/x/web-interface/search/type签名方式可能与普通API不同,遇-400时用网页端搜索提取BV号替代。
输出格式
下载视频保存至 bilibili_download/ 目录:
bilibili_download/
├── lidar360地面点分类和等高线绘制.mp4
├── lidar360点云数据处理教学视频机载林业-单木分割流程.mp4
└── lidar360点云数据处理教学视频地基林业-单木分割流程.mp4
支持文件
templates/search_videos.py— 视频搜索脚本模板templates/space_crawler.py— UP主空间爬取脚本模板templates/video_downloader.py— 单视频下载脚本模板references/bilibili-api-reference.md— B站API完整参考references/search-api-fallback.md— 搜索接口签名问题的网页端替代方案references/skillhub-upload-guide.md— SkillHub平台上传指南(API只读,需Web界面上传)
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供 B 站视频搜索、UP 主空间爬取、收藏夹解析、单个视频下载等完整功能闭环
- 解决用户明确的视频获取需求,属于高价值/高频刚需场景
Highlights
- description 明确描述核心功能,覆盖多种使用场景,触发词精准完整
Highlights
- 文档结构清晰,包含概述、前置条件、核心功能、关键技术实现、Pitfalls、输出格式等完整章节
- 有代码示例和端到端流程说明
Highlights
- 工具来源明确(requests、ffmpeg),参数说明详细
- 覆盖主要异常(Cookie 失效、WBI 签名超时、网络波动等),有重试机制和文件名处理
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 25
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Translation pending; see source documentation.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.