# Bilibili Trending Videos (`kjames2001/bilibili-trending-videos`) Actor

Get Bilibili trending/ranking videos, top creators, and hot search terms by category. Daily/weekly/monthly rankings with full engagement stats.

- **URL**: https://apify.com/kjames2001/bilibili-trending-videos.md
- **Developed by:** [James Huang](https://apify.com/kjames2001) (community)
- **Categories:** Social media, Videos
- **Stats:** 2 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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 Trending & Hot Videos Scraper | B站排行榜 & 热门视频

[![Apify Actor](https://img.shields.io/badge/Apify-Actor-blue)](https://apify.com/store)
[![Bilibili Ranking](https://img.shields.io/badge/Bilibili-Ranking-red)](https://www.bilibili.com/ranking)
[![Node.js 20](https://img.shields.io/badge/Node.js-20-green)](https://nodejs.org)
[![Pay Per Event](https://img.shields.io/badge/Pricing-Pay_per_Event-orange)](https://apify.com/pricing)

> Get **bilibili trending** videos, **bilibili hot videos**, and **bilibili ranking** data by category. Scrape daily, weekly, and all-time **B站排行榜** (Bilibili rankings) with full engagement metrics, creator stats, and comments. The most reliable **bilibili ranking scraper** for tracking **chinese video trends** — no login required.

### Features

- **Bilibili Trending Videos** — Get the current trending/hot video rankings across all categories
- **Category Rankings** — Filter by 20+ categories: anime, music, gaming, tech, life, knowledge, science, CS, and more
- **Ranking Types** — All content, original only, or rookie creators only
- **Creator Stats** — Follower counts and following counts for each video's creator
- **Full Engagement Metrics** — Views, likes, coins, favorites, shares, danmaku, reply counts
- **Comment Extraction** — Optional comment scraping for each trending video
- **Rank Position** — Each video includes its ranking position number
- **No Browser Needed** — Uses Bilibili's ranking API directly
- **Fast** — 100 trending videos with creator stats in under 30 seconds
- **No Login Required** — Works with Bilibili's public ranking API

### Use Cases

- **Trend Monitoring** — Track what's trending on B站 in real-time
- **Content Strategy** — Identify viral content patterns and **chinese video trends**
- **KOL Discovery** — Find top creators with the most followers in trending content
- **Market Research** — Understand what Chinese audiences are watching right now
- **Competitive Analysis** — Monitor which categories are producing **bilibili popular videos**
- **Social Listening** — Extract comments from trending videos for audience analysis
- **Academic Research** — Study Chinese digital media trends and content virality
- **SEO & Marketing** — Discover trending topics on B站 for content campaigns
- **Dashboard Feeds** — Feed real-time Bilibili rankings into analytics dashboards

### Input Parameters

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `rankingType` | select | No | `all` | Ranking type: All Content, Original Only, Rookie Only |
| `categoryId` | int | No | `0` | Category ID (0=all, 1=anime, 2=music, 3=gaming, 4=tech, 5=life, 36=knowledge, 188=science, 231=CS) |
| `getCreatorStats` | bool | No | `false` | Fetch follower counts for each video's creator |
| `extractComments` | bool | No | `false` | Extract comments for each trending video |
| `maxComments` | int | No | `50` | Max comments per video (1-5000) |
| `proxyConfiguration` | object | No | Apify proxy | Proxy config (residential recommended outside China) |

### Output Fields

#### Video Object (20+ fields)

| Field | Type | Description |
|---|---|---|
| `rank` | int | Ranking position (1-100) |
| `bvid` | string | Bilibili video ID (BV format) |
| `aid` | int | Bilibili video ID (AV format) |
| `title` | string | Video title |
| `description` | string | Video description |
| `author` | string | Creator name |
| `mid` | int | Creator user ID |
| `authorAvatar` | string | Creator avatar URL |
| `viewCount` | int | Total views |
| `likeCount` | int | Total likes |
| `coinCount` | int | Total coins |
| `favoriteCount` | int | Total favorites |
| `shareCount` | int | Total shares |
| `danmakuCount` | int | Total danmaku (bullet comments) |
| `replyCount` | int | Total comments |
| `duration` | int | Duration in seconds |
| `publishDate` | string | ISO date string |
| `coverUrl` | string | Cover image URL |
| `tags` | array | Video tags |
| `category` | string | Video category name |
| `url` | string | Video URL on bilibili.com |
| `creatorFollowers` | int | Creator follower count (if getCreatorStats=true) |
| `creatorFollowing` | int | Creator following count (if getCreatorStats=true) |
| `comments` | array | Comments (if extractComments=true) |
| `scrapedAt` | string | ISO timestamp of scraping |

### Category IDs

| ID | Category |
|---|---|
| 0 | All categories |
| 1 | Anime (动画) |
| 2 | Music (音乐) |
| 3 | Gaming (游戏) |
| 4 | Technology (科技) |
| 5 | Life (生活) |
| 36 | Knowledge (知识) |
| 188 | Science (科学) |
| 231 | Computer Science (计算机) |

### How It Works

1. **Select ranking type** — Choose All Content, Original Only, or Rookie Only
2. **Pick a category** — Filter by 20+ Bilibili content categories or get all
3. **API-based scraping** — The actor calls Bilibili's official ranking API directly
4. **Optional enrichment** — Fetch creator follower stats and/or comment threads
5. **Structured JSON output** — Results saved to Apify dataset with rank positions

### Pricing

This Actor uses **pay-per-event** pricing:

| Event | Cost |
|---|---|
| Actor start (1GB RAM) | $0.005 |
| Trending video scraped | $0.005 |
| Creator stats fetched | $0.003 |
| Comment extracted | $0.002 |

**Example**: 100 trending videos with creator stats and 50 comments each = $0.005 + (100 × $0.005) + (100 × $0.003) + (5000 × $0.002) = **$10.805**

### Technical Details

This **bilibili ranking scraper** uses Bilibili's official ranking API:
- Ranking: `api.bilibili.com/x/web-interface/ranking/v2`
- Creator stats: `api.bilibili.com/x/relation/stat`
- Comments: `api.bilibili.com/x/v2/reply/main`

No headless browser is needed. The scraper handles Bilibili's cookie-based access automatically. Residential proxies are recommended when running from outside China.

#### Runtime & SDK
- **Runtime:** Node.js 20
- **SDK:** Apify SDK v3 + Crawlee v3
- **Execution:** Single API calls, no browser overhead

### Why Use This vs Alternatives?

| Feature | This Actor | Bilibili Scraper (keyword) | Chinese Brand Monitor |
|---|---|---|---|
| Ranking/trending API | ✅ | ❌ (keyword search only) | ❌ |
| 20+ category filters | ✅ | ❌ | ❌ |
| Creator follower stats | ✅ | ❌ | ❌ |
| Comment extraction | ✅ | ✅ | ❌ |
| Rank position | ✅ | ❌ | ❌ |
| B站排行榜 data | ✅ | ❌ | ❌ |

### FAQ

<details>
<summary><b>How often does the Bilibili ranking update?</b></summary>
Bilibili's ranking API updates regularly. The all-content ranking reflects a rolling window of top-performing videos. Run the actor periodically to track changes over time.
</details>

<details>
<summary><b>What's the difference between ranking types?</b></summary>
"All Content" includes all videos. "Original Only" filters for original creations (原创). "Rookie Only" highlights new creators (新人).
</details>

<details>
<summary><b>Do I need a proxy?</b></summary>
If running from outside China, residential proxies are recommended to avoid IP-based rate limiting. From within China, the public API works without proxy.
</details>

<details>
<summary><b>Can I get comments from trending videos?</b></summary>
Yes. Enable `extractComments` and set `maxComments` (up to 5000 per video). Each comment includes author, likes, and timestamp.
</details>

### Keywords

`bilibili trending` · `bilibili hot videos` · `bilibili ranking` · `b站排行榜` · `bilibili ranking scraper` · `bilibili popular videos` · `chinese video trends` · `bilibili trending api` · `b站热门视频` · `bilibili rank tracker` · `bilibili top videos` · `bilibili ranking api` · `b站排名` · `bilibili hot list` · `bilibili trending scraper` · `bilibili leaderboard` · `chinese video ranking` · `bilibili analytics` · `bilibili category ranking` · `bilibili original content` · `b站趋势` · `bilibili viral videos` · `bilibili trending topics` · `china social media trends`

# Actor input Schema

## `rankingType` (type: `string`):

Type of ranking to fetch.
## `categoryId` (type: `integer`):

Bilibili category/region ID. 0 = all categories, 1 = anime, 2 = music, 3 = gaming, 4 = tech, 5 = life, 36 = knowledge, 188 = science, 231 = CS
## `getCreatorStats` (type: `boolean`):

Whether to fetch follower counts for each video's creator.
## `extractComments` (type: `boolean`):

Whether to extract comments for each trending video.
## `maxComments` (type: `integer`):

Maximum comments to extract per video.
## `proxyConfiguration` (type: `object`):

Apify proxy configuration. Use residential proxies if scraping from outside China.

## Actor input object example

```json
{
  "rankingType": "all",
  "categoryId": 0,
  "getCreatorStats": false,
  "extractComments": false,
  "maxComments": 50,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
````

# 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 = {
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("kjames2001/bilibili-trending-videos").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 = { "proxyConfiguration": { "useApifyProxy": True } }

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

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Bilibili Trending Videos",
        "description": "Get Bilibili trending/ranking videos, top creators, and hot search terms by category. Daily/weekly/monthly rankings with full engagement stats.",
        "version": "0.1",
        "x-build-id": "owXy9xfGxjNbs93p2"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/kjames2001~bilibili-trending-videos/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-kjames2001-bilibili-trending-videos",
                "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/kjames2001~bilibili-trending-videos/runs": {
            "post": {
                "operationId": "runs-sync-kjames2001-bilibili-trending-videos",
                "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/kjames2001~bilibili-trending-videos/run-sync": {
            "post": {
                "operationId": "run-sync-kjames2001-bilibili-trending-videos",
                "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",
                "properties": {
                    "rankingType": {
                        "title": "Ranking Type",
                        "enum": [
                            "all",
                            "origin",
                            "rookie"
                        ],
                        "type": "string",
                        "description": "Type of ranking to fetch.",
                        "default": "all"
                    },
                    "categoryId": {
                        "title": "Category ID (Region)",
                        "type": "integer",
                        "description": "Bilibili category/region ID. 0 = all categories, 1 = anime, 2 = music, 3 = gaming, 4 = tech, 5 = life, 36 = knowledge, 188 = science, 231 = CS",
                        "default": 0
                    },
                    "getCreatorStats": {
                        "title": "Get Creator Stats",
                        "type": "boolean",
                        "description": "Whether to fetch follower counts for each video's creator.",
                        "default": false
                    },
                    "extractComments": {
                        "title": "Extract Comments",
                        "type": "boolean",
                        "description": "Whether to extract comments for each trending video.",
                        "default": false
                    },
                    "maxComments": {
                        "title": "Max Comments per Video",
                        "minimum": 1,
                        "maximum": 5000,
                        "type": "integer",
                        "description": "Maximum comments to extract per video.",
                        "default": 50
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Apify proxy configuration. Use residential proxies if scraping from outside China."
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
