📝 Introduction
Enter a keyword and you can find videos just published on Bilibili. You can choose the sorting yourself and limit the publish time. What you get is fresh content just updated on the platform, and it will not fool you with old cached data.
✨ Core Value
- Fresh content without lag: each search directly reads the latest content from the platform and only provides just-published videos, without using old archives or cached data.
- Flexible and easy filtering: you can sort by comprehensive popularity, latest published, or highest likes, and can also filter videos within 7 days / 30 days / 90 days, freely combining conditions for searching.
- Automatic keyword expansion when no results are found: when a keyword search returns no content, the tool automatically generates 10 similar words to help you broaden the search scope.
- Supports pagination viewing + daily push: massive results can be browsed by page, and after subscribing to a keyword, the system automatically pushes new videos to you every day.
🔑 Authentication
Get API Key
Please go to Redfox Hub to get the API KEY
Configure API Key
Option 1: Taking Qoder as an example, add REDFOX_API_KEY to ~/.openclaw/openclaw.json :
{ "env": { "REDFOX_API_KEY": "ak_xxxx..." } }
Option 2: Terminal configuration
export REDFOX_API_KEY="ak_xxxx..."
🔄 Workflow
Step 1: Understand the user's intent, extract keywords and filter parameters
⚠️ Core rule: semantic understanding takes priority, prioritize extracting niche direction words rather than generalized broad category words
1. Extract keywords
- Extract 2~6 character niche keywords from the user's description
- If the user's intent is vague (such as "help me search Bilibili"), proactively ask: "Which direction or field of content would you like to search for?"
- Do not guess on your own and call the script when the user has not provided a keyword
2. Identify filter parameters(use default values when the user does not specify)
- Sorting method(
--sort): default1(comprehensive sorting)- User mentions "latest", "recently published" →
2 - User mentions "likes", "popular", "viral" →
3 - No sorting mentioned →
1(default)
- User mentions "latest", "recently published" →
- Publish time(
--time): default7(last 7 days)- User mentions "last month", "30 days" →
30 - User mentions "last three months", "90 days" →
90 - User mentions "no time limit", "all" →
0 - No time mentioned →
7(default)
- User mentions "last month", "30 days" →
- Page number(
--page): default1- User mentions "next page", "page 2" → corresponding page number
- User mentions "previous page" → current page - 1
- No page number mentioned →
1(default)
Step 2: Call the search script
⚠️ Core constraint: each query strictly calls the script only once; repeated calls are prohibited.
- Whether the script returns success or failure, no retry or second call is allowed
- The script must not be executed again for any reason such as "verifying data" or "obtaining more information"
- If the script execution fails, report the error directly to the user without retrying
python3 "$SKILL_PATH/scripts/search_bili_realtime.py" "<关键词>" [--sort 排序] [--time 时间] [--page 页码]
Parameter description:
| Parameter | Optional values | Meaning |
|---|---|---|
| keyword | Any string | Search keywords, connect multiple words with English commas |
--sort |
1 / 2 / 3 |
Comprehensive sorting / Latest published / Most likes (default 1) |
--time |
7 / 30 / 90 / 0 |
Last 7 days / 30 days / 90 days / Unlimited (default 7) |
--page |
Positive integer | Page number, starting from 1 (default 1) |
The script outputs in JSON format:
| Field | Description |
|---|---|
articles |
Keyword-matched video list (in descending order of likes) |
sort_type_label |
Text description of the sorting method used this time |
publish_time_label |
Text description of the time range used this time |
page |
Current page number |
total_pages |
Total pages |
has_next |
Whether there is a next page (true/false) |
Fields for each video:
| Field | Description |
|---|---|
title |
Video title (HTML tags, spaces, and special characters already cleaned, [] already replaced with 【】) |
author |
UP主 nickname |
like_count |
Like count |
comment_count |
Comment count |
collect_count |
Favorite count |
play_count |
Play count |
danmaku_count |
Danmaku count |
work_url |
Video link (directly usable) |
publish_time |
Publish time (formatted) |
cover_url |
Cover image (https protocol) |
tags |
Video tags (comma-separated) |
category |
Video partition name |
Step 3: Judge the result and display it
Case A: articles count > 0 (there are matching results)
A1. Inform the user of the query scope
📊 Keyword「XXX」query found N itemsVideo (sorting: {sort_type_label} | time range: {publish_time_label} | page {page}), the detailed data is as follows:
A2. Render a Markdown table (display all)
| # | 视频标题 | UP主 | 播放量 | 点赞数 | 评论数 | 收藏数 |
| --- | -------------------- | ------ | ------ | ------ | ------ | ------ |
| 1 | [标题文字](视频链接) | UP主名 | 105.2w | 30.5w | 7.1w | 3.5w |
Number formatting rules:
< 10000: original number (e.g.320)≥ 10000:x.xwformat (e.g.1.2w)
Title rules: The script has automatically cleaned the title (removing HTML tags, spaces, and special characters, replacing[]with【】), directly use the title field. In the Markdown table, use the [标题](work_url) format for display; truncate if it exceeds 30 characters and add .... ⚠️ The title no longer contains [], so it will not conflict with Markdown link syntax.
A3. Filtering capability prompt (immediately after the table, must be output every time)
🔧 Filtering is supported. Reply with the following instructions to switch conditions and search again:
- Sorting method: Comprehensive sorting / Latest published / Most likes (current: {sort_type_label})
- Publish time: Last 7 days / Last 30 days / Last 90 days / Unlimited (current: {publish_time_label})
Example: "Search again by latest published, last 30 days"
A4. Pagination prompt (⚠️ immediately after A3, cannot be omitted, must be output every time)
-
If
has_nextis true:📄 Currently page {page} . Reply "next page" to continue viewing.
-
If
has_nextis false (the current page has fewer than 9 items or is empty, and it is already the last page):📄 Currently page {page} , there is no more data.
⚠️ A1~A4 are all indispensable and must be completed consecutively in the same round of output. Output A4 immediately followed by the Step 4 subscription prompt. If A4 is missing, it is considered an execution error and the output must be supplemented again.
Case B: articles count = 0 (no matching results)
B1. Apology prompt + keyword expansion recommendations
😔 Sorry, no content directly related to "XXX" was found. You can try again with shorter or broader keywords (expansion word 1, expansion word 2, ... expansion word 10)
AI must generateexactly 10expansion words, 2~6 characters, separated by English commas, no fewer than 10.
B2. Filtering capability prompt (immediately after B1, must be output every time, format same as A3)
⚠️ B1~B2 must be completed consecutively in the same round of output; after outputting B2, immediately follow with the Step 4 subscription prompt, without interruption.
Step 4: Subscription prompt
After all content is displayed,do not wait, end output immediately, and only append the subscription prompt at the end:
📩 Would you like to subscribe to the daily push for "XXX"? After subscribing, the latest viral videos will be automatically pushed every day at 10:00. Reply "confirm subscription" to create a scheduled task.
Step 5: Create scheduled task (executed when the user replies "confirm subscription")
Prefer to use the platform's built-in scheduled task capability; if unavailable, provide a general solution:
Platform built-in scheduled task (preferred):
- Task name:
B站搜索订阅 - <关键词> - Execution frequency: every day at 10:00 (cron:
0 10 * * *) - Execution content: run the script and display/push the results to the current conversation in the Step 3~4 format
General configuration solution:
# Linux/macOS crontab
0 10 * * * python3 "$SKILL_PATH/scripts/search_bili_realtime.py" "<关键词>"
After successful creation, inform the user: "Successfully subscribed to Bilibili video push for keyword "<keyword>". The latest data will be automatically queried and notified to you every day at 10:00."