# 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, 1 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 web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

Download the OpenAPI definition: https://api.apify.com/v2/actors/TPG1BL8sUbFQSO1QE/builds/zOajgQ0uTiQ5UcfZH/openapi.json
