# Bilibili Pro Scraper (`habit.zhou/bilibili-pro-scraper`) Actor

Four-mode Bilibili scraper: keyword search, video detail by BV/AID, user profile + uploads, popular feed. Returns title, description, author, plays, danmaku, likes, favorites, duration, publish time, cover. No login. For China video trends, KOL research, AI training data.

- **URL**: https://apify.com/habit.zhou/bilibili-pro-scraper.md
- **Developed by:** [Seller Aim](https://apify.com/habit.zhou) (community)
- **Categories:** Social media, Videos, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.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.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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 Pro Scraper

Full-featured **Bilibili / 哔哩哔哩** scraper. Four modes, one Actor, clean structured JSON. No login, no cookies, no broken-token surprises.

Built for serious workloads — China-video research, UP creator discovery, AI training pipelines harvesting Chinese UGC, brand-watch dashboards, ML datasets of long-form Chinese video metadata.

### What does this Actor do?

Pick a mode, give it inputs, get a dataset:

- **Keyword search** — search Bilibili by keyword. Six sort options (comprehensive ranking, most played, newest, most danmaku, most favorited, most commented).
- **Video detail by BV / AID** — paste a `BV1xxxxxxxxx` code, an `av…` numeric ID, or a full `bilibili.com/video/...` URL; get title, description, UP info, plays, danmaku, likes, favorites, replies, cover, publish time, and (optional) top comments.
- **User profile + uploads** — fetch a UP's profile (avatar, bio, level, top banner) and their recent uploaded videos with pagination.
- **Popular / trending feed** — the public "Popular" feed (com_popular). Surfaces what's blowing up across the entire platform right now.

Each video returns a flat, schema-validated JSON row that's downloadable as JSON, CSV, Excel, HTML, or XML — and queryable via the Apify REST API for pipeline integration.

### Why use Bilibili Pro Scraper?

- **No cookies, no breakage.** Other Bilibili actors in the store ask the user for a logged-in `SESSDATA` cookie that expires within days. Customers end up with a stream of 412/-352 errors and 1.5★ reviews. We use a maintained backend surface that stays stable.
- **Four modes in one Actor.** Search, detail, user, popular — pick a mode per run; no juggling separate Actors.
- **Full-field output.** Title, description, UP name + uid, plays, danmaku, likes, favorites, replies, duration, publish time, cover URL, tags — all in one row.
- **AI training-ready.** Chinese-language UGC video metadata, clean JSON, deduplicable by `bvid`. Drop straight into a vector DB, an LLM fine-tune set, or a trend classifier.
- **Marketing dashboards.** Schedule keyword runs hourly and build a real-time pulse of any brand, product, or category on China's largest Gen-Z video platform.

### How to use

1. Open the Actor and click **Try for free**.
2. In the Input tab, pick a **Scrape mode** (search is the default).
3. Fill the inputs for your mode:
   - **search**: keywords, optional sort (`searchOrder`)
   - **videos**: BV codes / AV IDs / Bilibili URLs in `videoIds`
   - **user**: numeric UIDs in `userIds` (find in `space.bilibili.com/<uid>`)
   - **popular**: nothing required
4. Set **Max items per input** (default 50).
5. Click **Save & Start**. Results stream into the dataset live.
6. Download or stream the dataset; schedule the run under the **Schedules** tab.

### Input

| Field | Type | Used in mode | Description |
|---|---|---|---|
| `mode` | string | all | One of `search`, `videos`, `user`, `popular`. |
| `keywords` | array<string> | search | Search queries; Chinese or English. |
| `searchOrder` | enum | search | `totalrank` / `click` / `pubdate` / `dm` / `stow` / `scores`. |
| `videoIds` | array<string> | videos | BV codes, AV IDs, or full bilibili.com URLs. |
| `userIds` | array<string> | user | Numeric Bilibili UIDs. |
| `maxItemsPerInput` | integer (1–1000) | all | Cap per input. Default 50. |
| `fetchComments` | boolean | videos | Fetch up to 20 top comments per video. Extra cost. |

JSON example — keyword search:

```json
{
    "mode": "search",
    "keywords": ["AI编程", "Claude"],
    "searchOrder": "click",
    "maxItemsPerInput": 100
}
````

### Output

```json
{
    "bvid": "BV1xx411c7mD",
    "aid": "170001",
    "title": "Claude Code 完全入门指南",
    "description": "从安装到 Hooks 全流程演示。",
    "author": "AI研究室",
    "authorUid": "12345678",
    "authorPic": "https://i0.hdslb.com/bfs/face/abc.jpg",
    "cover": "https://i0.hdslb.com/bfs/archive/cover.jpg",
    "videoUrl": "https://www.bilibili.com/video/BV1xx411c7mD",
    "duration": "12:34",
    "plays": 482915,
    "danmaku": 2841,
    "likes": 39201,
    "favorites": 12480,
    "comments": 1832,
    "publishedAt": "2026-04-10T08:15:00.000Z",
    "typeName": "科技",
    "tags": ["AI", "编程", "Claude"],
    "keyword": "AI编程",
    "searchOrder": "click",
    "scrapedAt": "2026-05-22T13:45:00.000Z"
}
```

#### Output fields

| Field | Description |
|---|---|
| `bvid` | Bilibili BV code (use as canonical ID). |
| `aid` | Numeric AV ID (legacy). |
| `title` | Video title. |
| `description` | Video description / synopsis. |
| `author` | UP display name. |
| `authorUid` | Numeric UID — pair with `mode: "user"` to drill in. |
| `authorPic` | UP avatar URL. |
| `cover` | Cover image URL. |
| `videoUrl` | Public deep link. |
| `duration` | Video length. |
| `plays` | Total view count. |
| `danmaku` | Danmaku (bullet comment) count. |
| `likes` | Like count. |
| `favorites` | Favorite count. |
| `comments` | Reply / comment count. |
| `publishedAt` | ISO 8601 publish time. |
| `typeName` | Bilibili category name. |
| `tags` | Tags inferred from search metadata. |
| `userProfile` | UP profile object (user mode only). |
| `topComments` | Top 20 comments (videos mode with `fetchComments` only). |
| `scrapedAt` | ISO 8601 timestamp of scrape. |

### Pricing

**$3.99 per 1,000 results.** Each video returned counts as one result. `videos` mode with `fetchComments=true` returns richer rows but is billed at the same rate.

#### Cost estimates

| Goal | Items / run | Mode | Est. cost / run |
|---|---|---|---|
| Quick scan of one keyword | 50 | search | ~$0.20 |
| Category round-up | 500 | search | ~$2.00 |
| UP deep dive | 200 uploads | user | ~$0.80 |
| Daily brand monitoring | 1,000 | search | ~$4.00 / day |

Apify also charges a small compute fee (typically $0.01-0.05 per minute of run time).

### Tips

- **Schedule, don't poll.** Bilibili rotates the popular feed every few hours; scheduling daily / 6-hourly delivers the right cadence vs cost.
- **Deduplicate by `bvid`.** Sequential runs overlap; merge and dedupe on `bvid`.
- **Pair user + videos modes.** Use `mode: "user"` to find prolific UPs, then drill into each top video with `mode: "videos"` + `fetchComments`.
- **Pair `searchOrder: "pubdate"`** with hourly scheduling for real-time keyword monitoring.
- **Don't enable `fetchComments` unless you need them.** Each comment-bearing video takes an extra request.

### FAQ

**Q: Why is this Actor different from the other Bilibili scrapers on the Store?**
A: Most existing actors depend on a customer-provided `SESSDATA` cookie that expires in days. We don't ask for one. We've engineered around stable backend surfaces so the Actor stays usable across cookie expiries.

**Q: Will this break when Bilibili changes their API?**
A: Possibly. Our team maintains the backend; we patch usually within 24-72 hours of a backend change. Bug reports via the Issues tab.

**Q: Is scraping Bilibili legal?**
A: We pull only publicly-accessible content — what any visitor can see without an account. Your usage is your responsibility; comply with your jurisdiction's law and Bilibili's Terms of Service.

**Q: Can I get my data via API?**
A: Yes. Every Apify run exposes a stable [REST API](https://docs.apify.com/api/v2) for inputs, datasets, and run status. Plug into n8n, Make, Zapier, or your own pipeline.

**Q: How do I find a user's UID?**
A: Open the UP's profile on `space.bilibili.com`; the URL ends with `/<uid>` — that number is the UID.

**Q: How fast are runs?**
A: Search: ~3 seconds per page (~42 videos). User: ~2 seconds per page. Video detail: ~1 second per video. Popular: ~2 seconds per page.

**Q: I need a richer integration or higher-volume contract.**
A: Reach out via Apify chat. Custom endpoints and SLAs available on request.

# Actor input Schema

## `mode` (type: `string`):

What to pull from Bilibili.

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

Search queries. Chinese or English both work.

## `searchOrder` (type: `string`):

Sort criterion for search results.

## `videoIds` (type: `array`):

BV1xxxxxxxxx codes or numeric AIDs. Full https://www.bilibili.com/video/BV... URLs also accepted.

## `userIds` (type: `array`):

Numeric Bilibili user IDs (uid). Find them in the profile URL: space.bilibili.com/<uid>.

## `maxItemsPerInput` (type: `integer`):

Cap per keyword / user. Each item returned is one billed result.

## `fetchComments` (type: `boolean`):

When on, fetches up to 20 top comments per video (videos mode only). Extra cost per video.

## Actor input object example

```json
{
  "mode": "search",
  "keywords": [
    "AI"
  ],
  "searchOrder": "totalrank",
  "videoIds": [],
  "userIds": [],
  "maxItemsPerInput": 50,
  "fetchComments": false
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

# 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": [
        "AI"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("habit.zhou/bilibili-pro-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 = { "keywords": ["AI"] }

# Run the Actor and wait for it to finish
run = client.actor("habit.zhou/bilibili-pro-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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": [
    "AI"
  ]
}' |
apify call habit.zhou/bilibili-pro-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=habit.zhou/bilibili-pro-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Bilibili Pro Scraper",
        "description": "Four-mode Bilibili scraper: keyword search, video detail by BV/AID, user profile + uploads, popular feed. Returns title, description, author, plays, danmaku, likes, favorites, duration, publish time, cover. No login. For China video trends, KOL research, AI training data.",
        "version": "0.1",
        "x-build-id": "e9jwuP7O6MtfppTgo"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/habit.zhou~bilibili-pro-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-habit.zhou-bilibili-pro-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/habit.zhou~bilibili-pro-scraper/runs": {
            "post": {
                "operationId": "runs-sync-habit.zhou-bilibili-pro-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/habit.zhou~bilibili-pro-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-habit.zhou-bilibili-pro-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "mode"
                ],
                "properties": {
                    "mode": {
                        "title": "Scrape mode",
                        "enum": [
                            "search",
                            "videos",
                            "user",
                            "popular"
                        ],
                        "type": "string",
                        "description": "What to pull from Bilibili.",
                        "default": "search"
                    },
                    "keywords": {
                        "title": "Search keywords (search mode)",
                        "uniqueItems": true,
                        "type": "array",
                        "description": "Search queries. Chinese or English both work.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "searchOrder": {
                        "title": "Search ordering (search mode)",
                        "enum": [
                            "totalrank",
                            "click",
                            "pubdate",
                            "dm",
                            "stow",
                            "scores"
                        ],
                        "type": "string",
                        "description": "Sort criterion for search results.",
                        "default": "totalrank"
                    },
                    "videoIds": {
                        "title": "BV IDs or AIDs (videos mode)",
                        "type": "array",
                        "description": "BV1xxxxxxxxx codes or numeric AIDs. Full https://www.bilibili.com/video/BV... URLs also accepted.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "userIds": {
                        "title": "User UIDs (user mode)",
                        "type": "array",
                        "description": "Numeric Bilibili user IDs (uid). Find them in the profile URL: space.bilibili.com/<uid>.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxItemsPerInput": {
                        "title": "Max items per input",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Cap per keyword / user. Each item returned is one billed result.",
                        "default": 50
                    },
                    "fetchComments": {
                        "title": "Also fetch top comments per video",
                        "type": "boolean",
                        "description": "When on, fetches up to 20 top comments per video (videos mode only). Extra cost per video.",
                        "default": false
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
