Skip to content
dsh.fish
Bundle

bilibili-downloader-dsh

DeepSeek Harness plugin: B站(bilibili) 音视频下载助手 — bilidown CLI + 交互技能(412 反爬规避 / 扫码登录高清 / AV1 规避 / 合集秒下)

Source
menghuanshiguang
stars
1 stars
License
MIT
Updated
Updated 14 days ago

Readme

# ⬇️ dsh-bilibili-downloader — DeepSeek Harness 的 B站音视频下载插件

> 把 [bilibili-downloader-skill](https://github.com/menghuanshiguang/bilibili-downloader-skill)(交互技能)与 [bilibili-downloader-cli](https://github.com/menghuanshiguang/bilibili-downloader-cli)(`bilidown` CLI)整合成一个 **DeepSeek Harness Agent Preset(插件)**:安装后新建会话选择「B站下载助手」,给链接/BV号/歌名即可下载。

内置 **HTTP 412 反爬规避** + **扫码登录解锁高清** + **官方 API 直链秒下(561P 大合集不卡死)** + **AV1 自动规避(H.264 优先)** + **片段截取**。

```
你: 下载这个视频 https://www.bilibili.com/video/BV1GJ411x7h7
助手: 🎬 [在线预览](https://www.bilibili.com/blackboard/webplayer/mbplayer.html?bvid=BV1GJ411x7h7&p=1)
      该视频共 3 个分P: ... 下载哪个P?(数字/全部/取消)
你: 1
助手: 1. 音频  2. 视频+音频
...
```

## 🖥️ 支持环境

| 环境 | 说明 |
|------|------|
| **Linux / macOS** | ✅ 原生支持(bash 工具直接可用) |
| **Windows** | ✅ 需 [Git Bash](https://git-scm.com/download/win) 或 WSL。bilidown CLI 已做 Windows 适配(`bilidown.cmd` 入口,cmd/PowerShell 通用;代理通过 pwsh 工具直接执行 `bilidown ...`) |

### 依赖

| 工具 | 用途 | 安装示例 |
|------|------|---------|
| `bash` | 脚本运行 | Git Bash / WSL / 各平台自带 |
| `yt-dlp` | 核心下载引擎 | `pip install -U yt-dlp` / `apk add yt-dlp` |
| `curl` | API 请求、获取 cookies | 各平台自带 |
| `python3` | JSON 解析 | 各平台自带(Windows 只有 `python` 时脚本自动回退,无需配置) |
| `ffmpeg` / `ffprobe` | 视频合并 / 转码 | `brew install ffmpeg` / `apt install ffmpeg` / `winget install Gyan.FFmpeg` |

> ⚠️ **ffmpeg 为硬性依赖**:脚本启动时检测 `ffmpeg`/`ffprobe`,缺失时给出各平台安装指引(不再静默崩溃);音频/视频模式都需要。

## 🚀 安装

### 方式一:一键安装脚本(推荐)

```bash
# Linux / macOS / WSL
git clone https://github.com/menghuanshiguang/bilibili-downloader-dsh.git
cd bilibili-downloader-dsh
bash install.sh          # 安装到 ~/.dsh/.agent-presets/bilibili-downloader/
```

```powershell
# Windows PowerShell
git clone https://github.com/menghuanshiguang/bilibili-downloader-dsh.git
cd bilibili-downloader-dsh
powershell -ExecutionPolicy Bypass -File install.ps1
```

### 方式二:手动复制

把本仓库整个目录复制到 `~/.dsh/.agent-presets/bilibili-downloader/`(`$DSH_HOME` 已设置时用 `$DSH_HOME/.agent-presets/`)。

### 方式三:只装技能(已有其他 preset)

把 `skills/bilibili-downloader/` 复制到 `~/.dsh/skills/`,任何带 skill 工具的 preset 都能加载该技能(但不带专用 persona 与交互规则提示)。

### 方式四:官方 bundle 安装(全局生效,推荐给所有会话)

本仓库同时是**官方标准插件 bundle**(遵循 [DeepSeek Harness 架构文档](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/architecture.md) § Profiles and bundles):
`package.json` 声明 `dsh.bundle.patch` → `cordis.bundle.yml`,安装后所有会话自动获得 `bilibili-downloader` 技能(技能目录随包自包含分发):

```bash
# 1. 安装依赖(bundle 通过 npm/pnpm 解析到 profile):
#    把仓库目录加入 profile 的依赖与 bundles 列表:
#    ~/.dsh/profiles/<profile>/package.json
#    "dependencies": { "bilibili-downloader-dsh": "file:/path/to/仓库" }
#    "dsh": { "profile": { "bundles": [ ..., "bilibili-downloader-dsh" ] } }
#    (npm 发布后可改用: dsh plugin --profile <profile> add bilibili-downloader-dsh)
# 2. 重启 dsh 生效。验证: dsh --profile web --dump-config | grep skill-filesystem
```

> 三种形态的关系:preset(会话级,可选)/ 技能目录(手动)/ bundle(全局,官方分发格式)。核心技能内容共用 `skills/bilibili-downloader/` 一份。

### 安装 bilidown CLI(推荐,功能最全)

```bash
# Linux / macOS / WSL
git clone https://github.com/menghuanshiguang/bilibili-downloader-cli.git
cd bilibili-downloader-cli
bash install.sh          # 软链到 /usr/local/bin/bilidown
bilidown --version
```

```powershell
# Windows: 自动把 bin/ 加入用户 PATH, 提供 bilidown.cmd 入口
git clone https://github.com/menghuanshiguang/bilibili-downloader-cli.git
cd bilibili-downloader-cli
powershell -ExecutionPolicy Bypass -File install.ps1
# 新开终端后: bilidown --version
```

> 不装也行:代理可以用 `python <CLI仓库>/bin/bilidown.py ...` 直接运行(v2.0.0 起为 Python 单文件,无需安装即可用)。

> 💡 **单一实现**:v2.0.0 起 bilidown CLI 为 Python 单文件跨平台实现(不再有 bash 脚本版本),本插件不再内置脚本拷贝,只引用 CLI。

## 📖 使用

1. 重启 DeepSeek Harness(或直接新建会话)。
2. 会话选择器中选择 **「B站下载助手」**。
3. 直接发链接 / BV号 / b23.tv 短链 / UP主空间 / 歌名(如"去B站搜《兰花草》下载")。

代理会严格遵守技能硬性规则:先给在线预览 → 分P/音频视频/画质逐步单独询问(一次只问一个问题)→ 下载到工作区 `bilibili-downloads/` → 用紧凑格式 + 可点击链接回复。

## 📁 仓库结构

```
bilibili-downloader-dsh/
├── agent.cordis.yml                 # Preset 组合(会话级,插件本体)
├── preset.yml                       # 显示元数据(名称/描述)
├── package.json                     # 官方 bundle 声明(dsh.bundle.patch)
├── cordis.bundle.yml                # 官方 bundle patch(全局技能注入)
├── install.sh / install.ps1         # 安装脚本
├── skills/bilibili-downloader/      # 技能包(三种形态共用一份)
│   ├── SKILL.md                     # 交互技能(硬性规则:先预览/逐步询问/紧凑输出)
│   └── references/后处理.md          # 转码/命名参考
└── README.md / LICENSE
```

## 🔗 与上游仓库的关系

| 仓库 | 角色 | 本插件 |
|------|------|--------|
| [bilibili-downloader-cli](https://github.com/menghuanshiguang/bilibili-downloader-cli) | `bilidown` CLI 唯一实现(Python 单文件) | 只引用,不内置拷贝 |
| [bilibili-downloader-skill](https://github.com/menghuanshiguang/bilibili-downloader-skill) | 交互流程技能 | 适配为 DSH 技能(minis:// 播放链接 → DSH 工作区文件链接) |

## ⚠️ 注意事项

1. **游客模式视频仅 360P/480P**;720P+ 需扫码登录(`bilidown login`)。
2. **不绕过版权/付费墙**:仅下载用户有权访问的内容。
3. **B站风控**:批量勿高频,`list` 模式自带 3-6s 间隔。
4. **Windows**:bilidown 为 Python 实现,DSH 代理通过 pwsh 工具直接执行 `bilidown ...` 即可(无需 Git Bash)。
5. **短链 p 参数不可信**:b23.tv 的 `p=N` 只是分享停留位置,合集找歌用 `bilidown find`。

## 📄 许可证

MIT License(整合自两个上游 MIT 仓库,版权归 menghuanshiguang)。

Install

dsh plugin --profile web add github:menghuanshiguang/bilibili-downloader-dsh#06ae03efcb22bfbe45fa7388ebb4fee3a3a20947

Profile: web

Source