# Bilibili Video Details Scraper (`ahmed.fouaad82/bilibili-video-details`) Actor

Bilibili scraper for public video data: title, description, uploader, publish time, duration, views, likes, coins, favorites, shares, danmaku and comment counts, tags, category, cover and part list from video URLs or BV/AV IDs. No login.

- **URL**: https://apify.com/ahmed.fouaad82/bilibili-video-details.md
- **Developed by:** [Ahmed Fouad](https://apify.com/ahmed.fouaad82) (community)
- **Categories:** Social media, Videos
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$3.00 / 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.

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 Video Details Scraper

Bilibili scraper for public video data. Give it Bilibili video URLs or BV/AV IDs and get one clean row per video: title, description, uploader name and ID, publish time, duration, views, likes, coins, favourites, shares, danmaku count, comment count, tags, category, cover URL and the full part (P) list. No login, no cookies, no API key.

Use it as a lightweight **Bilibili API** alternative for video analytics, trend tracking, influencer research, or feeding Bilibili video data to AI agents.

### Quick start

```json
{
  "videoUrls": [
    "https://www.bilibili.com/video/BV17x411w7KC/",
    "BV1Qt411T7VS",
    "av2"
  ],
  "maxItems": 100
}
```

Accepted formats: `https://www.bilibili.com/video/BV…`, `https://m.bilibili.com/video/BV…`, `BV17x411w7KC`, `av170001`, `170001`. Duplicates (the same video as BV and AV) are removed. b23.tv short links are not resolved; open them and paste the full URL.

### Output

One dataset row per video (JSON, CSV, Excel via Apify datasets):

| Field | Meaning |
|---|---|
| `bvid`, `aid`, `url` | BV ID, numeric AV ID, canonical video URL |
| `requested` | The input entry that produced the row |
| `title`, `description` | Video title and description |
| `uploaderId`, `uploaderName` | Uploader's public user ID (mid) and display name |
| `publishedAt`, `publishTimestamp` | Publish time (ISO 8601 UTC / Unix seconds) |
| `durationSeconds` | Total duration |
| `views`, `likes`, `coins`, `favorites`, `shares` | Engagement counters |
| `danmakuCount`, `commentCount` | Bullet-comment and comment counts (texts not collected) |
| `tags` | Public tag names (background-music tags excluded) |
| `categoryId`, `categoryName`, `parentCategoryName`, `legacyCategoryId` | Category (zone) |
| `coverUrl` | Cover image (HTTPS) |
| `isOriginal` | Original upload (`true`) or repost (`false`) |
| `partCount`, `parts` | Number of parts and `[{page, cid, title, durationSeconds}]` |
| `fetchedAt` | Fetch time |

Example row (abridged):

```json
{"bvid":"BV17x411w7KC","aid":170001,"title":"【MV】保加利亚妖王AZIS视频合辑","uploaderId":122541,"uploaderName":"冰封.虾子","publishedAt":"2011-11-09T14:55:33.000Z","durationSeconds":2412,"views":45840786,"likes":943698,"coins":295112,"favorites":876828,"shares":44354991,"danmakuCount":915692,"commentCount":184255,"tags":["保加利亚妖王","保加利亚","Азис","azis","mv"],"categoryId":2017,"categoryName":"MV","parentCategoryName":"音乐","partCount":10}
```

The `SUMMARY` record in the run's key-value store lists totals, the stop reason, every video that failed (removed, private, region-restricted or invalid input) and network bytes.

### Pricing (proposed, not active)

Proposed pay-per-event price: **$3.00 per 1,000 videos ($0.003 per `result`)**. You would pay only for videos returned in the dataset; invalid IDs, removed or region-restricted videos and failed requests are never charged. The run stops cleanly when your spending limit is reached. This pricing is a proposal and is not configured on the Actor yet.

### How it works

- Reads the public, server-rendered video page `www.bilibili.com/video/<BV>/` (allowed by Bilibili's robots.txt) and stops downloading as soon as the embedded video data is complete.
- Bilibili answers HTTP 412 to most cloud IPs. The Actor tries a direct request first and switches to the proxy from `proxyConfiguration` (default: Apify residential, China) only after a 412.
- Polite by default: 2 parallel requests, at least 400 ms between requests, exponential backoff and session rotation on errors.

### Limits

- Video details only. **Popular, ranking and search lists are not included**: they are served only by `api.bilibili.com`, whose robots.txt disallows all automated access. Collect IDs another way (e.g. from the website) and pass them in.
- No login, cookies, CAPTCHA solving, comment texts, danmaku texts, follower counts or uploader profiles. Members-only, paid, private and region-locked videos are reported as failed in SUMMARY.
- Counters are a snapshot at fetch time. `categoryName` comes from the page's own category list and can be null for retired categories.
- You are responsible for how you use and redistribute the data under Bilibili's terms and applicable law.

# Actor input Schema

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

List of Bilibili videos to scrape. Each entry can be a full video URL (https://www.bilibili.com/video/BV17x411w7KC/ or m.bilibili.com), a BV ID (BV17x411w7KC), an AV ID with prefix (av170001) or a bare numeric AV ID (170001). Duplicates are removed; invalid entries are reported in the SUMMARY record and never billed. b23.tv short links are not resolved: open them in a browser and paste the full URL.

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

Upper limit of videos returned (one dataset row and one charged result per video). Extra input entries beyond this number are skipped.

## `maxConcurrency` (type: `integer`):

How many video pages are fetched at the same time (1-5). Requests are also spaced at least 400 ms apart with exponential backoff on errors, to stay polite to Bilibili.

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

Bilibili answers HTTP 412 to most cloud and datacenter IPs. The Actor tries a direct request first and switches to this proxy only after a 412. The default (Apify residential, China) is what the measured pricing assumes; turning the proxy off usually makes cloud runs fail.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.bilibili.com/video/BV17x411w7KC/"
  ],
  "maxItems": 100,
  "maxConcurrency": 2,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "CN"
  }
}
```

# Actor output Schema

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

Video metadata rows

## `summary` (type: `string`):

Counts, per-video errors, bytes per item

# 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 = {
    "videoUrls": [
        "https://www.bilibili.com/video/BV17x411w7KC/"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "CN"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("ahmed.fouaad82/bilibili-video-details").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 = {
    "videoUrls": ["https://www.bilibili.com/video/BV17x411w7KC/"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "CN",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("ahmed.fouaad82/bilibili-video-details").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 '{
  "videoUrls": [
    "https://www.bilibili.com/video/BV17x411w7KC/"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "CN"
  }
}' |
apify call ahmed.fouaad82/bilibili-video-details --silent --output-dataset

```

## MCP server setup

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

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/dqqUz7jAN7DjKSvAI/builds/LQhVbM0m1e2ymxGno/openapi.json
