Bilibili Search Skill
Search for videos on Bilibili based on the user's interests and soul profile. Supports both LLM-driven automatic query generation (for discovery cycles) and direct keyword search (for explicit user requests).
When to Use
- During content discovery cycles
- When the user explicitly asks to find content on a topic
- When generating exploratory searches for new interest domains
How It Works
- Query generation — If no explicit
keywords are provided, the skill uses an LLM to generate multiple search queries from the user's soul profile (top interests, cognitive style, deep needs). If keywords are provided, they are used directly.
- Sequential search — Each query is sent to the Bilibili WBI-signed search endpoint sequentially, with a jitter-randomised 0.5–1.0s delay between queries (v0.3.61+) so the requests don't land in the same Bilibili rate-limit bucket. A dedicated API client is used per strategy to isolate rate-limiting.
- Resilience & storm mode — Individual query failures (including Bilibili
412 Precondition Failed) degrade gracefully and don't interrupt the overall flow. client.search retries v_voucher challenges 3× internally; three consecutive empty results trip "storm mode" (v0.3.61+) and the remaining queries are skipped (filled with empty results) rather than burned against an IP that's being challenged — the next refresh tick (~60s) gets a fresh shot. An active search cooldown short-circuits the remaining plan the same way.
- Scoring — Results are evaluated against the soul profile via LLM and assigned a
relevance_score (0.0–1.0). Items below the threshold are discarded.
- Output — Returns scored
DiscoveredContent items.
Parameters
| Parameter |
Type |
Required |
Default |
Description |
keywords |
string |
No |
"" |
Search query string. If empty, the skill auto-generates queries from the soul profile. |
page |
integer |
No |
1 |
Page number for paginated results. |
limit |
integer |
No |
20 |
Maximum number of results to return. |
order |
string |
No |
"totalrank" |
Sort order. One of: "totalrank" (relevance), "pubdate" (newest), "click" (most viewed), "dm" (most commented). |
Input Schema (JSON Schema)
{
"type": "object",
"properties": {
"keywords": {
"type": "string",
"description": "Search query string. Auto-generated from profile if empty."
},
"page": {
"type": "integer",
"minimum": 1,
"default": 1
},
"limit": {
"type": "integer",
"minimum": 1,
"default": 20
},
"order": {
"type": "string",
"enum": ["totalrank", "pubdate", "click", "dm"],
"default": "totalrank"
}
}
}
Output
Each result is a DiscoveredContent object with the following fields:
| Field |
Type |
Description |
bvid |
string |
Bilibili video BV ID |
title |
string |
Video title |
up_name |
string |
Creator's display name |
up_mid |
integer |
Creator's user ID |
cover_url |
string |
Video cover image URL |
duration |
integer |
Video length in seconds |
view_count |
integer |
Play count |
like_count |
integer |
Like count |
description |
string |
Video description |
tags |
string[] |
Video tags |
relevance_score |
number |
LLM-evaluated relevance (0.0–1.0) |
relevance_reason |
string |
Human-readable reason for the score |
source_strategy |
string |
Always "search" for this skill |
topic_key |
string |
Semantic topic classification |
style_key |
string |
Content style classification |
Requirements
- Bilibili Cookie authentication is required for search to function. Without it, Bilibili may return
412 Precondition Failed and the skill will return empty results.
- The skill connects to Bilibili's public API at
https://api.bilibili.com; no additional API keys are needed beyond the B站 Cookie.
Limitations
- Rate Limiting: Bilibili applies rate-limiting and anti-bot protections. Under heavy usage, search requests may return
412 Precondition Failed and degrade to empty results.
- Platform Restriction: The skill returns content from Bilibili only. Cross-platform search is not supported.
- Cookie Dependency: Search functionality depends on valid Bilibili Cookie authentication.
Special Case Handling
Empty Keywords
When keywords is empty or not provided:
- The skill automatically generates search queries based on the user's soul profile (top interests, cognitive style, deep needs)
- Multiple queries are generated and executed sequentially with delays between requests
- Results are aggregated and deduplicated
412 Precondition Failed
When Bilibili returns 412 Precondition Failed:
- The skill treats this as a temporary failure for that query
- Other queries continue execution
- The skill returns results from successful queries only
- If all queries fail, returns an empty result set with appropriate logging
Network Errors & Timeouts
v_voucher challenge / transient failure: client.search retries the WBI request up to 3× internally; an empty list at the strategy layer means the keyword exhausted its retries (the IP is being challenged), which feeds the storm-mode counter above
- DNS Failure: Falls back gracefully without breaking other queries
- SSL Errors: Logs the error and skips to next query
Empty Search Results
- If no results are found for a query, returns an empty list for that query
- If all queries return empty, the skill returns an empty result set
- The discovery engine will try alternative strategies
Invalid Parameters
- Invalid
page: Passed directly to API (no clamping — caller should validate)
- Invalid
limit: Passed directly to API (no clamping — caller should validate)
- Invalid
order: Passed directly to API; defaults to "totalrank" if not provided
- Empty string keywords: Treated as auto-generate mode
Special Characters in Keywords
- Keywords are URL-encoded before sending to Bilibili API
- Unicode characters are supported
- Long keywords are passed as-is (no length truncation)
API Response Edge Cases
- Unexpected response format: Gracefully parses what it can, logs warnings for missing fields
- Partial results: Returns valid items even if some fields are missing
- Rate limiting: Handled via the per-query jitter delay, internal
v_voucher retries, and storm-mode/cooldown short-circuit described above (no Retry-After header parsing)
1---2name: bilibili-search3description: Search for videos on Bilibili using keyword queries generated from user interests.4---5
6# Bilibili Search Skill
7
8Search for videos on Bilibili based on the user's interests and soul profile. Supports both LLM-driven automatic query generation (for discovery cycles) and direct keyword search (for explicit user requests).
9
10## When to Use
11
12- During content discovery cycles
13- When the user explicitly asks to find content on a topic
14- When generating exploratory searches for new interest domains
15
16## How It Works
17
181. **Query generation** — If no explicit `keywords` are provided, the skill uses an LLM to generate multiple search queries from the user's soul profile (top interests, cognitive style, deep needs). If `keywords` are provided, they are used directly.
192. **Sequential search** — Each query is sent to the Bilibili WBI-signed search endpoint sequentially, with a jitter-randomised 0.5–1.0s delay between queries (v0.3.61+) so the requests don't land in the same Bilibili rate-limit bucket. A dedicated API client is used per strategy to isolate rate-limiting.
203. **Resilience & storm mode** — Individual query failures (including Bilibili `412 Precondition Failed`) degrade gracefully and don't interrupt the overall flow. `client.search` retries `v_voucher` challenges 3× internally; three consecutive empty results trip "storm mode" (v0.3.61+) and the remaining queries are skipped (filled with empty results) rather than burned against an IP that's being challenged — the next refresh tick (~60s) gets a fresh shot. An active search cooldown short-circuits the remaining plan the same way.
214. **Scoring** — Results are evaluated against the soul profile via LLM and assigned a `relevance_score` (0.0–1.0). Items below the threshold are discarded.
225. **Output** — Returns scored `DiscoveredContent` items.
23
24## Parameters
25
26| Parameter | Type | Required | Default | Description |
27|-----------|------|----------|---------|-------------|
28| `keywords` | `string` | No | `""` | Search query string. If empty, the skill auto-generates queries from the soul profile. |
29| `page` | `integer` | No | `1` | Page number for paginated results. |
30| `limit` | `integer` | No | `20` | Maximum number of results to return. |
31| `order` | `string` | No | `"totalrank"` | Sort order. One of: `"totalrank"` (relevance), `"pubdate"` (newest), `"click"` (most viewed), `"dm"` (most commented). |
32
33## Input Schema (JSON Schema)
34
35```json
36{
37 "type": "object",
38 "properties": {
39 "keywords": {
40 "type": "string",
41 "description": "Search query string. Auto-generated from profile if empty."
42 },
43 "page": {
44 "type": "integer",
45 "minimum": 1,
46 "default": 1
47 },
48 "limit": {
49 "type": "integer",
50 "minimum": 1,
51 "default": 20
52 },
53 "order": {
54 "type": "string",
55 "enum": ["totalrank", "pubdate", "click", "dm"],
56 "default": "totalrank"
57 }
58 }
59}
60```
61
62## Output
63
64Each result is a `DiscoveredContent` object with the following fields:
65
66| Field | Type | Description |
67|-------|------|-------------|
68| `bvid` | `string` | Bilibili video BV ID |
69| `title` | `string` | Video title |
70| `up_name` | `string` | Creator's display name |
71| `up_mid` | `integer` | Creator's user ID |
72| `cover_url` | `string` | Video cover image URL |
73| `duration` | `integer` | Video length in seconds |
74| `view_count` | `integer` | Play count |
75| `like_count` | `integer` | Like count |
76| `description` | `string` | Video description |
77| `tags` | `string[]` | Video tags |
78| `relevance_score` | `number` | LLM-evaluated relevance (0.0–1.0) |
79| `relevance_reason` | `string` | Human-readable reason for the score |
80| `source_strategy` | `string` | Always `"search"` for this skill |
81| `topic_key` | `string` | Semantic topic classification |
82| `style_key` | `string` | Content style classification |
83
84## Requirements
85
86- Bilibili Cookie authentication is required for search to function. Without it, Bilibili may return `412 Precondition Failed` and the skill will return empty results.
87- The skill connects to Bilibili's public API at `https://api.bilibili.com`; no additional API keys are needed beyond the B站 Cookie.
88
89## Limitations
90
91- **Rate Limiting**: Bilibili applies rate-limiting and anti-bot protections. Under heavy usage, search requests may return `412 Precondition Failed` and degrade to empty results.
92- **Platform Restriction**: The skill returns content from Bilibili only. Cross-platform search is not supported.
93- **Cookie Dependency**: Search functionality depends on valid Bilibili Cookie authentication.
94
95## Special Case Handling
96
97### Empty Keywords
98When `keywords` is empty or not provided:
991. The skill automatically generates search queries based on the user's soul profile (top interests, cognitive style, deep needs)
1002. Multiple queries are generated and executed sequentially with delays between requests
1013. Results are aggregated and deduplicated
102
103### 412 Precondition Failed
104When Bilibili returns `412 Precondition Failed`:
1051. The skill treats this as a temporary failure for that query
1062. Other queries continue execution
1073. The skill returns results from successful queries only
1084. If all queries fail, returns an empty result set with appropriate logging
109
110### Network Errors & Timeouts
111- **`v_voucher` challenge / transient failure**: `client.search` retries the WBI request up to 3× internally; an empty list at the strategy layer means the keyword exhausted its retries (the IP is being challenged), which feeds the storm-mode counter above
112- **DNS Failure**: Falls back gracefully without breaking other queries
113- **SSL Errors**: Logs the error and skips to next query
114
115### Empty Search Results
116- If no results are found for a query, returns an empty list for that query
117- If all queries return empty, the skill returns an empty result set
118- The discovery engine will try alternative strategies
119
120### Invalid Parameters
121- **Invalid `page`**: Passed directly to API (no clamping — caller should validate)
122- **Invalid `limit`**: Passed directly to API (no clamping — caller should validate)
123- **Invalid `order`**: Passed directly to API; defaults to `"totalrank"` if not provided
124- **Empty string keywords**: Treated as auto-generate mode
125
126### Special Characters in Keywords
127- Keywords are URL-encoded before sending to Bilibili API
128- Unicode characters are supported
129- Long keywords are passed as-is (no length truncation)
130
131### API Response Edge Cases
132- **Unexpected response format**: Gracefully parses what it can, logs warnings for missing fields
133- **Partial results**: Returns valid items even if some fields are missing
134- **Rate limiting**: Handled via the per-query jitter delay, internal `v_voucher` retries, and storm-mode/cooldown short-circuit described above (no `Retry-After` header parsing)