# Bilibili Scraper - Videos, Search & Trending (`kodenova/bilibili-scraper`) Actor

Scrape Bilibili (哔哩哔哩) videos by keyword, video URL or trending list. Get title, views, likes, coins, favorites, comments, danmaku, author, tags and publish date. No login, no browser, pay only per result.

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

## Pricing

from $2.50 / 1,000 video 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?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Bilibili Scraper - Videos, Search & Trending (哔哩哔哩)

Scrape **Bilibili** videos by keyword, video URL or the trending (热门) list and export views, likes, coins, favorites, comments, danmaku, author and tags to JSON, CSV or Excel. Built for brand monitoring, influencer discovery, China market research and AI/RAG datasets. **No login, no cookies, no browser** — and about **5× cheaper** than other Bilibili scrapers.

**What you get**

- **Video data:** BV ID, title, description, thumbnail, duration, category, tags, publish date
- **Engagement:** views, likes, coins, favorites, shares, comments count, danmaku (bullet comments) count
- **Creator:** UP主 name, user ID and channel link

### Sample output

```json
{
  "bvid": "BV1rpWjevEip",
  "aid": 113006243481679,
  "url": "https://www.bilibili.com/video/BV1rpWjevEip",
  "title": "【全748集】目前B站最全最细的Python零基础全套教程",
  "author": "Python官方课程",
  "authorId": 3546597933714079,
  "authorUrl": "https://space.bilibili.com/3546597933714079",
  "thumbnail": "https://i2.hdslb.com/bfs/archive/a979056b1a32012cdd00d48fbc3732d253e30620.jpg",
  "views": 20910089,
  "likes": 576400,
  "coins": 410683,
  "favorites": 886400,
  "shares": 103671,
  "comments": 362096,
  "danmaku": 133474,
  "durationSec": 143894,
  "category": "计算机技术",
  "tags": ["程序员", "Python教程", "Python入门零基础"],
  "publishedAt": "2024-08-22T14:59:18.000Z",
  "source": "search:python",
  "scrapedAt": "2026-10-18T10:00:00.000Z"
}
```

### How to use (3 steps)

1. Enter **search keywords** (Chinese or English), paste **video URLs**, or tick **Include trending**.
2. Set **Max results** (you only pay for results you get).
3. Click **Start**, then download as JSON, CSV, Excel — or call it via API / MCP.

### Input

| Field | What it does | Example |
|---|---|---|
| `searchKeywords` | Search Bilibili videos (up to 1,000 per keyword) | `["原神", "iPhone 17"]` |
| `videoUrls` | Full stats for specific videos (BV, av or full URL) | `["BV1rpWjevEip"]` |
| `includeTrending` | Add the current 热门 popular list | `true` |
| `sortBy` | Relevance, most views, newest, most danmaku, most favorites | `"pubdate"` |
| `includeDetails` | Add coins, shares and exact likes to search results | `true` |
| `maxItems` | Stop after N results in total | `500` |
| `maxItemsPerQuery` | Cap per keyword | `200` |

### Pricing in plain words

Pay per result: **about $4 per 1,000 videos**, plus a tiny start fee. 100 videos ≈ $0.40. No monthly rental. Apify's free plan ($5/month credit) covers more than 1,000 videos to try it out.

### FAQ

**Do I need a Bilibili account or cookies?** No. The scraper uses Bilibili's public web data only.

**Can I scrape Bilibili search results by newest?** Yes — set *Sort search results by* to *Newest* to monitor new videos for a brand or keyword. Schedule it daily for brand monitoring.

**How many results per keyword?** Bilibili's own search shows max 50 pages × 20 = 1,000 videos per keyword. Use several related keywords to collect more.

**Does it get comments, danmaku or creator profiles?** This Actor returns their counts. Full comment text is in our companion *Bilibili Comments Scraper* (see Related Actors).

**I get 412 errors / few results.** Bilibili rate-limits some data-center IPs. Re-run with the proxy set to *RESIDENTIAL*; the scraper retries automatically.

**Is it legal?** It collects only publicly visible video data. You are responsible for using the data in line with Bilibili's terms and the laws in your country (e.g. GDPR / PIPL). Don't use it to collect private personal data.

### Use via API / MCP

```bash
curl -X POST "https://api.apify.com/v2/acts/kodenova~bilibili-scraper/run-sync-get-dataset-items?token=<APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"searchKeywords":["原神"],"maxItems":50,"sortBy":"pubdate"}'
```

AI agents (Claude, ChatGPT, Cursor) can call this Actor through the Apify MCP server: `https://mcp.apify.com/?tools=kodenova/bilibili-scraper`.

### Related Actors

- [Bilibili Comments Scraper](https://apify.com/kodenova/bilibili-comments-scraper) — full comment text and replies
- Bilibili Creator (UP主) Scraper — profile and all videos of a channel *(coming soon)*

Need a custom scraper for another Chinese or Asian platform? Open an issue on this Actor and describe what you need.

# Actor input Schema

## `searchKeywords` (type: `array`):

Keywords to search on Bilibili, in Chinese or English (e.g. 原神, python, iPhone 17 review). Each keyword returns up to 1,000 videos (Bilibili's own limit).

## `videoUrls` (type: `array`):

Bilibili video links or IDs, e.g. https://www.bilibili.com/video/BV1rpWjevEip or BV1rpWjevEip or av170001. Always returns full stats.

## `includeTrending` (type: `boolean`):

Also scrape Bilibili's current popular / trending list.

## `sortBy` (type: `string`):

Order of search results: relevance, most views, newest, most danmaku or most favorites.

## `includeDetails` (type: `boolean`):

Fetch each search result's video page to add coins, shares, exact likes and category. Slower; same price per result.

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

Run stops after this many results. You only pay per result saved.

## `maxItemsPerQuery` (type: `integer`):

Optional cap per keyword / trending list. Defaults to Max results.

## `proxyConfiguration` (type: `object`):

Apify Proxy is used by default. Switch to RESIDENTIAL only if you see repeated 412 blocks.

## Actor input object example

```json
{
  "searchKeywords": [
    "python"
  ],
  "includeTrending": false,
  "sortBy": "totalrank",
  "includeDetails": false,
  "maxItems": 100,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

All scraped items in the default dataset.

## `runSummary` (type: `string`):

Success rate and error counts for this run.

# 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 = {
    "searchKeywords": [
        "python"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("kodenova/bilibili-scraper").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 = {
    "searchKeywords": ["python"],
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("kodenova/bilibili-scraper").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 '{
  "searchKeywords": [
    "python"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call kodenova/bilibili-scraper --silent --output-dataset

```

## MCP server setup

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

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/LJBJa8lidorpcW4cb/builds/D9Mna3tzubU1Sul3h/openapi.json
