# Bilibili Search Extractor (`kawsar/bilibili-search-extractor`) Actor

Bilibili search scraper that turns any keyword into structured video data: titles, links, uploaders, play and danmaku counts, duration, and publish dates, so you can track trends and research content without any login.

- **URL**: https://apify.com/kawsar/bilibili-search-extractor.md
- **Developed by:** [Kawsar](https://apify.com/kawsar) (community)
- **Categories:** Videos, Developer tools, Social media
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.99 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Bilibili Search Extractor

Turn any Bilibili search into clean, structured data. Give the actor a list of keywords in Chinese or English and it returns every matching video with its title, direct link, cover image, uploader, play count, danmaku count, duration, and publish date.

Bilibili is one of the largest video platforms in China, and its search results are a rich source of signals for content, marketing, and SEO research. This actor collects those results for you at scale, with no login, no browser automation to babysit, and no manual copy and paste.

### Why use this actor

- **Keyword research at scale.** Feed a whole list of terms and get a combined dataset back in one run.
- **SEO and content strategy.** See which videos rank for a keyword, who publishes them, and how they perform.
- **Competitor and brand monitoring.** Track how a game, show, product, or campaign is covered on Bilibili over time.
- **Trend spotting.** Pull play and danmaku counts to find what is gaining traction in a niche.
- **Ready for pipelines.** Export to JSON, CSV, or Excel, or pull results straight from the dataset API.

### Features

- Search Bilibili by any keyword, in Chinese or English
- Batch mode: pass many keywords in a single run
- Automatic pagination up to the limit you set
- Per keyword limit, so each term gets a fair share of results
- Play and danmaku counts returned both as shown on the site and parsed to integers
- Per keyword error handling: one bad term never fails the whole run
- Scheduling friendly, so your dataset stays current

### Input

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `keywords` | array of strings | Yes | | Search terms to look up on Bilibili. Results from all keywords land in one dataset. |
| `maxItems` | integer | No | 33 | Maximum number of videos to collect **per keyword**. Up to 1000. |
| `requestTimeoutSecs` | integer | No | 30 | Per request timeout in seconds. |

#### Example input

```json
{
    "keywords": ["哈利波特", "原神", "英雄联盟"],
    "maxItems": 33
}
```

With this input, the actor collects up to 33 videos for each of the three keywords, for up to 99 results total.

### Output

The actor writes one record per video to the dataset. Example record:

```json
{
    "keyword": "哈利波特",
    "bvid": "BV1eRhg6NEc4",
    "videoUrl": "https://www.bilibili.com/video/BV1eRhg6NEc4/",
    "videoTitle": "哈利波特来B站了",
    "coverUrl": "https://i1.hdslb.com/bfs/archive/8ddcc00f2929aa4b4beece5b089ef14e76d4b887.jpg",
    "author": "飞毛腿_摩根",
    "authorUrl": "https://space.bilibili.com/390186540",
    "authorId": "390186540",
    "plays": "3407",
    "playsCount": 3407,
    "danmaku": "7",
    "danmakuCount": 7,
    "duration": "04:05",
    "publishedText": "5小时前",
    "scrapedAt": "2026-08-25T10:58:39.856865+00:00"
}
```

#### Output fields

| Field | Type | Description |
|-------|------|-------------|
| `keyword` | string | The search term this result came from. |
| `bvid` | string | Bilibili video ID (BV code). |
| `videoUrl` | string | Direct link to the video. |
| `videoTitle` | string | Video title. |
| `coverUrl` | string | Thumbnail image URL. |
| `author` | string | Uploader name. |
| `authorUrl` | string | Uploader channel URL. |
| `authorId` | string | Uploader numeric ID. |
| `plays` | string | Play count as shown on the site, for example `43.2万`. |
| `playsCount` | integer | Play count parsed to a plain number. |
| `danmaku` | string | Danmaku (on screen comment) count as shown on the site. |
| `danmakuCount` | integer | Danmaku count parsed to a plain number. |
| `duration` | string | Video length, for example `04:05`. |
| `publishedText` | string | Publish date as shown on the site, for example `5小时前` or `07-31`. |
| `scrapedAt` | string | UTC timestamp of when the result was collected. |

If a keyword fails, the actor still writes a record for it with an `error` field and a `scrapedAt` timestamp, so nothing is silently dropped.

### How to use

1. Open the actor and enter one or more keywords.
2. Set **Max items per keyword** if you want more or fewer than the default of 33.
3. Click **Start**.
4. When the run finishes, download the results as JSON, CSV, or Excel, or read them from the dataset API.

#### Run on a schedule

Use Apify **Schedules** to run the actor every hour, day, or week. Each run appends fresh results, which is useful for tracking how rankings and view counts change over time.

#### Get results from the API

Every run stores results in a dataset you can fetch directly:

```
https://api.apify.com/v2/datasets/{datasetId}/items?format=json
```

### Tips and notes

- **Chinese keywords work best** for Chinese content, since Bilibili is a China focused platform. English terms also work.
- **Play and danmaku counts** on Bilibili use `万` (ten thousand) and `亿` (hundred million). The actor keeps the original text and also gives you a parsed integer in `playsCount` and `danmakuCount`.
- **Publish dates** are shown relative (`6小时前`, meaning 6 hours ago) or as `MM-DD` for older videos, matching how Bilibili displays them.
- **Per keyword limits** mean a run with 5 keywords and a limit of 33 can return up to 165 records.
- **Higher limits take longer.** The first page of each keyword loads quickly. To go beyond roughly the first 35 results, the actor loads deeper result pages in full, which adds a few seconds per page. A limit of 100 typically fetches three pages per keyword.

### Frequently asked questions

**Do I need a Bilibili account?**
No. The actor does not require any login.

**Can I search many keywords at once?**
Yes. Add as many as you like to the `keywords` list. Each is searched independently and the limit applies to each one.

**What if a keyword returns no results?**
The run continues with the next keyword. Empty results simply add no records.

**Which formats can I export?**
JSON, CSV, Excel, HTML, RSS, and more through the dataset export options and API.

# Actor input Schema

## `keywords` (type: `array`):

One or more search terms to look up on Bilibili. Chinese and English keywords are both supported. Results from every keyword are combined into a single dataset.

## `maxItems` (type: `integer`):

Maximum number of video results to collect for each keyword. Applied per keyword, not across the whole run.

## `requestTimeoutSecs` (type: `integer`):

Per-request timeout in seconds.

## Actor input object example

```json
{
  "keywords": [
    "哈利波特",
    "原神"
  ],
  "maxItems": 33,
  "requestTimeoutSecs": 30
}
```

# Actor output Schema

## `results` (type: `string`):

Bilibili video search results with titles, links, authors, and stats.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "keywords": [
        "哈利波特",
        "原神"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("kawsar/bilibili-search-extractor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "keywords": [
        "哈利波特",
        "原神",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("kawsar/bilibili-search-extractor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "keywords": [
    "哈利波特",
    "原神"
  ]
}' |
apify call kawsar/bilibili-search-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,kawsar/bilibili-search-extractor"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/c5kJddls1wt1cwk7G/builds/wjqdaoXmN37cgOWn5/openapi.json
