Introduction

When connecting information sources to agents, Bilibili is an unavoidable category: finding videos on a specific topic, summarizing an episode, or verifying what was actually discussed in the video. The trouble lies in the fact that Bilibili pages are highly dynamic, making direct web scraping unreliable; providing only the model with subtitle text is also insufficient—when subtitles say “as shown in the figure,” the model doesn’t know what is actually on the screen.

DeepSeek Harness (DSH) adopts the philosophy that everything is a plugin, with external capabilities attached to sessions as tools. dsh-plugin-bilibili does exactly this: after installation, the agent gains five bilibili_* tools, covering keyword search, video metadata, subtitle transcripts, direct playback URLs, and video frames. The frames are returned as image blocks, allowing models with image capabilities to view the real footage directly, rather than inferring from subtitles alone. Below is an introduction to its features, installation, and configuration.

Overview

dsh-plugin-bilibili is a Bilibili retrieval plugin for DeepSeek Harness, maintained by moxingovo, licensed under MIT, and currently at version 0.2.1.

Its default state is anonymous availability: search automatically guides anonymous cookies, and metadata is always available. Optionally, you can configure a SESSDATA to unlock logged-in subtitle tracks (where most AI subtitles reside), higher quality playback addresses, and frame preview paths. The plugin only reads metadata, subtitles, and frame images; it does not store, re-upload, download, or process video or audio files.

Core Features: Five Tools

  • bilibili_search — Search for videos by keyword, returning title, uploader, views, duration, and publish date.
  • bilibili_video — Complete metadata for a single video: various counts, categories, part pages, and description.
  • bilibili_subtitles — Subtitle transcript for a single video, merged into plain text.
  • bilibili_playurl — Direct mp4 playback address (including authorized quality and size), used for downloading or frame extraction.
  • bilibili_frames — Real video frames (preview sprite grid, fallback cover, or ffmpeg extraction) returned as image blocks, for models with image capabilities to view the actual footage.

The connected workflow is: first use bilibili_search to find candidates, then use bilibili_video to confirm metadata; when text content is needed, use bilibili_subtitles; when visuals are needed, use bilibili_playurl to get the direct link, and bilibili_frames to return the image blocks.

Installation and Enablement

Install with a single command:

dsh plugin --profile web add dsh-plugin-bilibili

You can also install directly from the Git repository:

dsh plugin --profile web add git+https://github.com/moxingovo/dsh-bilibili

After installation, restart dsh web; new sessions will automatically gain the five tools mentioned above. Note that bilibili_frames additionally requires the attachments service, which is already mounted in the standard web bundle, so no extra action is usually needed.

There is a known upstream issue to be aware of: official DeepSeek Harness early release candidate packages (dsh-agent / dsh-session versions 0.0.1-rc.1 and 0.0.1-rc.2) declared an unpublished peer dependency @deepseek-ai/dsh-type-meta, which may result in a 404 when resolving to these versions during a fresh install. There are two workarounds: run npm ci with a locked package-lock.json inside the plugin repository, or run dsh plugin add in an already installed harness workspace. This is a publishing issue during the upstream RC phase and will disappear once the metadata is fixed upstream.

Optional: Configuring SESSDATA

You can use it without configuring SESSDATA, but you will only get publicly visible subtitle tracks; subtitles requiring login will fail and return the structured error code BILIBILI_LOGIN_REQUIRED. If you need logged-in subtitles and higher quality, follow these three steps:

  1. Log in to bilibili.com, open DevTools → Application → Cookies → the bilibili.com entry;
  2. Copy the bare token of SESSDATA (not the entire cookie header);
  3. Write it to an environment variable, or write it to .env under DSH_HOME:
BILIBILI_SESSDATA=<your-bare-token>

Configuration Options

The plugin provides the following default values:

Configuration Default Value Meaning
cookieEnv BILIBILI_SESSDATA Environment variable name to store SESSDATA
requestTimeoutMs 30000 Single request timeout (milliseconds)
subtitleLanguage zh-CN Preferred subtitle language, exact match preferred, otherwise the first track
searchMaxPageSize 20 Pagination upper limit for bilibili_search
subtitleMaxChars 80000 Character limit for subtitle transcript; exceeding this will truncate and append a truncated marker

All fields can be overridden in profiles/web/cordis.patch.yml, with later lines taking precedence.

Error Codes and Security Design

When tools fail, structured errors are returned. The main error codes are:

  • BILIBILI_RISK_CONTROL — Corresponds to -412 risk control; retry later; the plugin has built-in anonymous cookie guidance.
  • BILIBILI_FORBIDDEN — Corresponds to -403.
  • BILIBILI_NOT_FOUND — Corresponds to -404.
  • BILIBILI_LOGIN_REQUIRED — Corresponds to -101, commonly seen with subtitles.
  • BILIBILI_SUBTITLES_UNAVAILABLE — No accessible subtitle tracks or the main text is empty.
  • BILIBILI_REDIRECT_REFUSED — Credential security guard: all requests refuse redirection.
  • BILIBILI_BAD_RESPONSE — Response is not JSON or missing the code wrapper.
  • BILIBILI_REQUEST_FAILED — Network error.
  • BILIBILI_WBI_KEYS_UNAVAILABLE — Signature key missing.

There are four explicit security constraints: cookies are read only from environment variables and do not enter configuration files, logs, or tool outputs; all requests refuse redirection, so cookies are not forwarded to other sources; cookies are only sent to api.bilibili.com; subtitle CDN downloads do not carry cookies; and video or audio files are not downloaded.

Supporting Skills and Local Development

The repository’s skills/ directory includes two supporting skills: plugin-tool-bilibili explains tool usage, and plugin-web-bilibili explains service configuration and error codes. Copy them into the harness’s skills directory, and the agent will consult them before making calls.

If you want to modify code or run tests: Node 22 or higher, run npm ci then npm test. The test suite is fully offline (mock HTTP), and typecheck targets published DeepSeek Harness packages.

npm ci
npm test

Applicable Scenarios and Precautions

Target audience: Agents running on dsh web that need Bilibili as an information source, especially tasks that require reading subtitle text or allowing multimodal models to view the footage directly to verify content.

Points to note:

  1. The plugin runs with the permissions of the current dsh process; you should inspect the source code and license before installing (this project is MIT);
  2. SESSDATA is a login credential; refer to the previous section for the scope of reading and sending by the plugin; it is recommended to use it only in trusted environments;
  3. Encountering BILIBILI_RISK_CONTROL (-412) is a risk control issue; retry later as prompted;
  4. The plugin does not download video or audio files; bilibili_frames additionally requires the attachments service (the standard web bundle is already mounted).

Summary

dsh-plugin-bilibili integrates Bilibili’s retrieval, subtitles, and visuals into the DSH tool ecosystem: anonymous availability by default, and with SESSDATA configured, it covers logged-in subtitles and higher quality. Error codes are structured, and there are clear constraints on the paths for credential reading and sending. The community plugin directory page is at https://www.skillhub.cn/plugins/moxingovo/dsh-bilibili, and the source code and README can be found at https://github.com/moxingovo/dsh-bilibili.