# Bilibili Video Scraper (`hgservices/bilibili-video-scraper`) Actor

Download Bilibili (哔哩哔哩) videos and export video details — title, author, views, likes, coins, danmaku, comments — to JSON, CSV, or Excel. Just paste any Bilibili video link.

- **URL**: https://apify.com/hgservices/bilibili-video-scraper.md
- **Developed by:** [Harish Garg](https://apify.com/hgservices) (community)
- **Categories:** Videos, AI, MCP servers
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

### What does Bilibili Video Scraper do?

**Bilibili Video Scraper** lets you **download Bilibili (哔哩哔哩) videos** and export their full details in one step. Paste any Bilibili video or share link and get back a clean, structured record for each video — including a **direct MP4 download link**, plus the title, description, author, and complete engagement stats: views, likes, coins, favorites, shares, danmaku (bullet comments), and replies. You can also have the video files saved for you automatically.

It works with videos from [bilibili.com](https://www.bilibili.com), China's largest video-sharing platform. Run it on demand, on a schedule, or via API, and connect the results to Google Sheets, Make, Zapier, Google Drive, and hundreds of other apps.

### Why use Bilibili Video Scraper?

- **Download videos as MP4** — get clean files ready to save, archive, or analyze.
- **Bulk export** — process dozens or thousands of Bilibili videos in a single run.
- **Content & trend research** — collect titles, descriptions, and Bilibili's unique engagement signals (views, likes, coins, favorites, danmaku) for analysis.
- **Save time** — no manual copying; export everything to JSON, CSV, or Excel with a click.
- **Automate it** — schedule runs and push results straight into your favorite tools.

### How to use Bilibili Video Scraper

1. Open the Actor in the [Apify Console](https://console.apify.com/).
2. Paste one or more Bilibili video URLs into the **Bilibili video URLs** field.
3. (Optional) Turn on **Download video files** to save the MP4s, and choose a **preferred video quality**.
4. Click **Start** ▶.
5. When the run finishes, browse the results in the **Output** tab, or download them as JSON, CSV, or Excel. The Output tab also shows quick links to **Video details** and, if you enabled downloads, the **Downloaded videos** store — one click to the files.

### Input

| Field | Description |
|-------|-------------|
| **Bilibili video URLs** | One or more Bilibili video or share links to scrape. |
| **Download video files** | Save each MP4 so you can download it directly (a video link is always included either way). |
| **Preferred video quality** | Choose the best (highest quality) or smallest file for each video. |
| **Max videos** | Limit how many videos to process in a run. |
| **Proxy configuration** | Optional. Most runs don't need it; you can enable it if you scrape at very high volume. |

#### Supported links

- `https://www.bilibili.com/video/BV1xx411c7mD` (BV ID)
- `https://www.bilibili.com/video/av170001` (legacy AV ID)
- `https://b23.tv/...` (share links)
- A bare `BV...` or `av...` ID

#### Example input

```json
{
    "startUrls": [
        { "url": "https://www.bilibili.com/video/BV1xx411c7mD" }
    ],
    "downloadVideos": true,
    "videoQuality": "best"
}
````

### Output

Each video becomes one row in your dataset. You can download the dataset in various formats such as JSON, HTML, CSV, or Excel.

```json
{
    "bvid": "BV1xx411c7mD",
    "aid": 2,
    "url": "https://www.bilibili.com/video/BV1xx411c7mD",
    "title": "字幕君交流场所",
    "description": "www",
    "authorName": "碧诗",
    "authorId": 2,
    "viewCount": 5355132,
    "likeCount": 271222,
    "coinCount": 39421,
    "favoriteCount": 125846,
    "shareCount": 21765,
    "danmakuCount": 127830,
    "commentCount": 88545,
    "durationSeconds": 2055,
    "publishedAt": "2009-09-09T01:09:09Z",
    "coverUrl": "https://i0.hdslb.com/bfs/archive/...png",
    "videoUrl": "https://.../video.mp4",
    "videoQuality": 16,
    "downloadUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/video-BV1xx411c7mD.mp4"
}
```

> `downloadUrl` is only present when **Download video files** is enabled. It links to the MP4 saved in the run's key-value store. It works directly from the Apify API/CLI or the Console; to open it in a plain browser, append `?token=<YOUR_APIFY_TOKEN>`. If you just want a link that always opens without a token, use `videoUrl`.

#### Data you get for every video

| Field | Description |
|-------|-------------|
| `bvid`, `aid` | Bilibili's BV and legacy AV identifiers |
| `url` | Link to the video on Bilibili |
| `title`, `description` | Video title and description |
| `category` | Bilibili category / partition name |
| `authorName`, `authorId`, `authorAvatar` | Uploader (UP主) name, ID, and avatar |
| `viewCount`, `likeCount`, `coinCount`, `favoriteCount`, `shareCount` | Engagement numbers |
| `danmakuCount`, `commentCount` | Bullet comments (弹幕) and replies |
| `durationSeconds`, `publishedAt` | Length and publish date |
| `coverUrl` | Thumbnail image |
| `videoUrl` | Direct MP4 download link |
| `videoQuality` | Resolution of the video you get (e.g. 720p, 480p, 360p) |
| `downloadUrl` | Direct link to the saved MP4 in storage (only when **Download video files** is on) |
| `pages` | The individual parts of a multi-part video |
| `availableQualities` | All resolutions available for the video |

### How much does it cost to scrape Bilibili?

Runs are fast and inexpensive — you can typically export **thousands of videos for just a few cents**. The main thing that affects cost is whether you turn on **Download video files**, since saving the actual MP4s uses more storage. If you only need the details and download links, leave it off to keep runs as cheap as possible. New Apify accounts also come with **free monthly usage credits** to get started.

### Tips

- **Just want the links?** Leave **Download video files** off — every result still includes a `videoUrl` you can open or download anytime.
- **Pick your resolution** with **Preferred video quality**, or check `availableQualities` to see everything Bilibili reports for a video.
- **Scraping in bulk?** Add all your URLs at once and let a single run handle them.

### FAQ, disclaimers & support

**Is it legal to scrape Bilibili?** This Actor collects publicly available data. You are responsible for how you use it and must comply with Bilibili's Terms of Service, copyright law, and applicable privacy regulations. Don't use downloaded content in ways that infringe creators' rights.

**What video quality do I get?** Videos are provided as ready-to-play MP4 files in resolutions up to 720p HD. Use the **Preferred video quality** option to pick the best available or the smallest file for each video.

**Why did a video fail?** Private, deleted, members-only (大会员), or region-restricted videos may not be available and are skipped. Video details are still returned whenever a video file isn't available.

**Need help or have a request?** Use the **Issues** tab on the Actor's page to report problems or suggest features. Custom scraping solutions are available on request.

# Actor input Schema

## `startUrls` (type: `array`):

One or more Bilibili video or share URLs. Supported formats: https://www.bilibili.com/video/{BVid}, https://www.bilibili.com/video/av{number}, https://b23.tv/{code} (share link), or a bare BV / av ID.

## `downloadVideos` (type: `boolean`):

If enabled, the MP4 is downloaded and stored in the run's key-value store (a `videoUrl` is always included in the output regardless). Storing large files increases storage usage; leave off if you only need metadata and direct URLs.

## `videoQuality` (type: `string`):

Which video quality to get as the primary `videoUrl` / download. 'best' gives the highest available resolution (up to 720p HD), 'worst' gives the smallest file. The output reports the resolution of the video you receive.

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

Maximum number of videos to process (0 = no limit).

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

Proxy settings. Proxy is OFF by default, which keeps runs fast and cheap and works for most use cases. Enable Apify Proxy only if you scrape at very high volume and start seeing blocks.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.bilibili.com/video/BV1xx411c7mD"
    }
  ],
  "downloadVideos": false,
  "videoQuality": "best",
  "maxItems": 0,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

No description

## `videos` (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 = {
    "startUrls": [
        {
            "url": "https://www.bilibili.com/video/BV1xx411c7mD"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("hgservices/bilibili-video-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 = { "startUrls": [{ "url": "https://www.bilibili.com/video/BV1xx411c7mD" }] }

# Run the Actor and wait for it to finish
run = client.actor("hgservices/bilibili-video-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 '{
  "startUrls": [
    {
      "url": "https://www.bilibili.com/video/BV1xx411c7mD"
    }
  ]
}' |
apify call hgservices/bilibili-video-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Bilibili Video Scraper",
        "description": "Download Bilibili (哔哩哔哩) videos and export video details — title, author, views, likes, coins, danmaku, comments — to JSON, CSV, or Excel. Just paste any Bilibili video link.",
        "version": "0.1",
        "x-build-id": "UQP0ylhytcO0HTVRi"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/hgservices~bilibili-video-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-hgservices-bilibili-video-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/hgservices~bilibili-video-scraper/runs": {
            "post": {
                "operationId": "runs-sync-hgservices-bilibili-video-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/hgservices~bilibili-video-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-hgservices-bilibili-video-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": [
                    "startUrls"
                ],
                "properties": {
                    "startUrls": {
                        "title": "Bilibili video URLs",
                        "type": "array",
                        "description": "One or more Bilibili video or share URLs. Supported formats: https://www.bilibili.com/video/{BVid}, https://www.bilibili.com/video/av{number}, https://b23.tv/{code} (share link), or a bare BV / av ID.",
                        "items": {
                            "type": "object",
                            "required": [
                                "url"
                            ],
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "title": "URL of a web page",
                                    "format": "uri"
                                }
                            }
                        }
                    },
                    "downloadVideos": {
                        "title": "Download video files",
                        "type": "boolean",
                        "description": "If enabled, the MP4 is downloaded and stored in the run's key-value store (a `videoUrl` is always included in the output regardless). Storing large files increases storage usage; leave off if you only need metadata and direct URLs.",
                        "default": false
                    },
                    "videoQuality": {
                        "title": "Preferred video quality",
                        "enum": [
                            "best",
                            "worst"
                        ],
                        "type": "string",
                        "description": "Which video quality to get as the primary `videoUrl` / download. 'best' gives the highest available resolution (up to 720p HD), 'worst' gives the smallest file. The output reports the resolution of the video you receive.",
                        "default": "best"
                    },
                    "maxItems": {
                        "title": "Max videos",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Maximum number of videos to process (0 = no limit).",
                        "default": 0
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Proxy settings. Proxy is OFF by default, which keeps runs fast and cheap and works for most use cases. Enable Apify Proxy only if you scrape at very high volume and start seeing blocks.",
                        "default": {
                            "useApifyProxy": 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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
