# How Agent-Reach Handles Bilibili After yt-dlp Was Blocked: Multi-Backend Fallback Architecture

> Agent-Reach automatically switches to bili-cli, OpenCLI, or a zero-dependency API when yt-dlp fails on Bilibili. Discover its multi-backend fallback architecture.

- Repository: [Pnant/Agent-Reach](https://github.com/Panniantong/Agent-Reach)
- Tags: architecture
- Published: 2026-06-28

---

**Agent-Reach treats Bilibili as a multi-backend channel that automatically falls back to bili-cli, OpenCLI, or a zero-dependency search API when yt-dlp is blocked by Bilibili's risk-control systems.**

In June 2026, Bilibili's risk-control systems began blocking requests from yt-dlp, forcing the Agent-Reach project (Panniantong/Agent-Reach) to completely remove yt-dlp support for this platform. The current implementation in [`agent_reach/channels/bilibili.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/channels/bilibili.py) now dynamically selects from three alternative backends to ensure continuous access to Bilibili content.

## Why yt-dlp Was Removed from Bilibili Support

The file header in [`agent_reach/channels/bilibili.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/channels/bilibili.py) explicitly documents that **yt-dlp** was removed because Bilibili's risk-control system started blocking its requests (lines 4-9). This upstream disruption rendered yt-dlp unreliable for Bilibili extraction, necessitating a complete architectural pivot to alternative data sources that avoid detection by the platform's anti-automation measures.

## The Three-Backend Architecture

Agent-Reach now implements a **multi-backend channel** with three distinct data sources, prioritized by capability and reliability:

### bili-cli

The **bili-cli** backend provides search functionality, hot lists, and video details without requiring login credentials. It serves as the primary option for users who need basic metadata extraction. Installation requires `pipx install bilibili-cli`. Note that subtitle extraction requires the OpenCLI backend as a complement.

### OpenCLI

**OpenCLI** offers the full feature set including subtitle extraction by re-using an existing browser session. This backend provides the most comprehensive access but requires additional setup via `agent-reach install --channels opencli`. The channel communicates with OpenCLI through the `opencli_status` helper defined in [`agent_reach/backends/opencli.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/backends/opencli.py).

### B站搜索 API

The **B站搜索 API** backend operates as a zero-dependency fallback that supports searching via simple HTTP requests to `https://api.bilibili.com/x/web-interface/search/all/v2`. This requires no additional software installation and ensures basic functionality remains available even when other backends are not present on the system.

## Backend Selection and Probing Logic

The core selection logic resides in the `check` method of [`agent_reach/channels/bilibili.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/channels/bilibili.py). This method iterates over the `ordered_backends` list and executes dedicated probe functions for each candidate:

- **`_check_bili_cli`**: Verifies bili-cli installation and functionality
- **`_check_opencli`**: Validates OpenCLI availability through the status helper
- **`_check_search_api`**: Performs a lightweight health check via `_search_api_ok`

The first backend returning an `"ok"` or `"warn"` status becomes the **active backend** (`self.active_backend`), while subsequent backends in the list serve as fallbacks.

### Graceful Degradation and Error Reporting

If a higher-priority backend is installed but broken, the channel reports the error while preserving **broken notes** from fallback backends. This gives users complete visibility into which backends are functional versus failing. When no backend is usable, `check` returns an `"off"` status with installation hints for bili-cli and OpenCLI (lines 76-80).

### API Health Check Implementation

The `_search_api_ok` helper performs a lightweight `GET` request to Bilibili's public search endpoint. If the response JSON contains `"code": 0`, the search API is considered reachable (lines 24-33). This minimal check ensures the fallback backend is viable before selection.

## Usage Examples

### Command Line Interface

```bash

# Read a Bilibili video URL - automatically selects best available backend

agent-reach read https://www.bilibili.com/video/av12345678

# Install the recommended backend for full functionality

pipx install bilibili-cli
agent-reach install --channels opencli

```

### Programmatic Access

```python
from agent_reach.core import AgentReach

ar = AgentReach()
result = ar.read("https://www.bilibili.com/video/av12345678")

# Internally uses the active Bilibili backend (bili-cli, OpenCLI, or search API)

print(result)

```

## Summary

- **Agent-Reach** removed yt-dlp support for Bilibili in June 2026 after Bilibili's risk-control systems began blocking its requests.
- The channel now implements a **multi-backend architecture** with three fallback options: bili-cli, OpenCLI, and the B站搜索 API.
- Backend selection occurs dynamically through the `check` method in [`agent_reach/channels/bilibili.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/channels/bilibili.py), which probes candidates in order of priority.
- **Graceful degradation** ensures users receive clear error messages and installation guidance when backends fail or are unavailable.
- The **zero-dependency search API** provides guaranteed basic functionality via HTTP requests to Bilibili's public search endpoint.

## Frequently Asked Questions

### What happened to yt-dlp support for Bilibili in Agent-Reach?

Bilibili's risk-control system began blocking yt-dlp requests in June 2026, making the extraction tool unreliable. Consequently, the development team completely removed yt-dlp from the Bilibili channel implementation in [`agent_reach/channels/bilibili.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/channels/bilibili.py) and replaced it with alternative backends.

### Which backend should I install for full Bilibili functionality?

Install **OpenCLI** using `agent-reach install --channels opencli` for the complete feature set including subtitle extraction. Alternatively, install **bili-cli** via `pipx install bilibili-cli` for basic search and video details without subtitle support. The system will automatically use whichever backend you have installed.

### How does Agent-Reach choose which backend to use?

The `check` method probes backends in the order defined by `ordered_backends`: first bili-cli, then OpenCLI, finally the B站搜索 API. It selects the first backend returning an `"ok"` or `"warn"` status. If all backends fail, it returns `"off"` with installation instructions.

### Can I use Agent-Reach for Bilibili without installing any additional software?

Yes. The **B站搜索 API** backend requires no installation and operates via HTTP requests to Bilibili's public search endpoint (`https://api.bilibili.com/x/web-interface/search/all/v2`). However, this backend only supports search functionality and lacks video extraction capabilities available through bili-cli or OpenCLI.