# Bilibili 哔哩哔哩 Scraper (`parsebird/bilibili-scraper`) Actor

Scrape Bilibili (哔哩哔哩, B站) videos by keyword, video details, comments, danmaku (弹幕), UP主 profiles and catalogues, plus 热门 trending and 热搜. Views, likes, coins, favourites. Export JSON, CSV, Excel.

- **URL**: https://apify.com/parsebird/bilibili-scraper.md
- **Developed by:** [ParseBird](https://apify.com/parsebird) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $7.49 / 1,000 videos

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 哔哩哔哩 Scraper

**Bilibili 哔哩哔哩 Scraper** extracts public data from [Bilibili](https://www.bilibili.com/) (哔哩哔哩, B站, 哔站), one of China's largest video platforms. Search videos by keyword, pull full video stats, comments, danmaku (弹幕) bullet comments, UP主 creator profiles and complete UP主 video lists, or track the 热门 trending feed and 热搜 hot-search terms. No Bilibili account, cookie or API key needed.

<table><tr>
<td style="border-left:4px solid #1C1917;padding:12px 16px;font-weight:600">
Seven modes in one Actor: keyword search with free sort, length and date filters, video details with tags, parts and cid, comments with reply threads, second-by-second danmaku, UP主 profiles with fans and verification, full UP主 catalogues, and the 热门 / 热搜 trending lists, all with plays, likes, coins (投币), favourites (收藏), shares and danmaku counts.
</td>
</tr></table>

##### Copy to your AI assistant

Copy this block into ChatGPT, Claude, Cursor, or any LLM to start using this actor.

```
Apify Actor: parsebird/bilibili-scraper. Scrapes public Bilibili (哔哩哔哩, B站) data without login. Call via ApifyClient: client.actor("parsebird/bilibili-scraper").call(run_input={"searchType": "search", "keywords": ["编程"], "sortOrder": "click", "maxItems": 50}). Inputs: searchType (string, default "search": one of search, video-detail, comments, danmaku, profile, user-videos, trend), keywords (string[], used by search), videoUrls (string[]: bilibili.com/video URLs, BV ids, av ids or b23.tv links; add ?p=N for a part; used by video-detail, comments, danmaku), userUrls (string[]: space.bilibili.com URLs or numeric UIDs; used by profile and user-videos), maxItems (integer, default 20, max 5000: results per keyword, video or UP主 for search, comments, user-videos, trend), sortOrder (totalrank | click | pubdate | dm | stow, default totalrank), durationFilter (any | short | medium | long | verylong), publishedAfter / publishedBefore (YYYY-MM-DD, China time), trendType (videos | keywords), includeReplies (boolean, default false). Output: one row per result with searchType. Videos: bvid, aid, title, desc, url, cover, duration (s), category, category_id, tags, pubdate, published_at, part_count, view_count, like_count, coin_count, favorite_count, share_count, danmaku_count, reply_count, owner {mid, name, avatar}; video-detail adds cid, parts, dimension, copyright, dynamic, owner_fans; trend adds rcmd_reason, pub_location. Comments: rpid, content, like_count, reply_count, ctime, root, is_pinned, up_liked, up_replied, user_level, user_vip, user_verified, user, replies. Danmaku: dmid, text, progress (seconds), mode, fontsize, color, ctime, sender_hash. Profiles: mid, name, avatar, sign, sex, level, fans, following, verified, verify_desc, vip, video_count, likes. Hot search: rank, keyword, show_name, heat_score. Pricing: pay per event (video, video detail, comment, profile, danmaku per video, trending row). Full API spec: https://apify.com/parsebird/bilibili-scraper/api. Get your token: https://console.apify.com/settings/integrations.
```

### What is Bilibili 哔哩哔哩 Scraper?

**Bilibili 哔哩哔哩 Scraper** turns Bilibili into structured data. Type a keyword, paste video links or add UP主 (creator) UIDs, pick a mode and click **Start**. You get clean rows with play counts, likes, coins, favourites, danmaku counts, comments and creator stats, ready to download as **JSON, CSV or Excel** or to read through the API.

It works as a **Bilibili API alternative**: no Bilibili developer account, login, cookie or API key needed. Every row is tagged with the mode that produced it, so you can mix results in one dataset and still sort them.

### What can Bilibili Scraper do?

- 🔎 **Search Bilibili videos by keyword.** Sort by best match (综合排序), most played, newest, most danmaku or most favourited. Filter by video length and publish date. Filters are applied by Bilibili, so a narrow search returns, and bills, fewer videos.
- 🎬 **Get full video details.** Stats including coins and shares, tags, every part (分P) with its cid, resolution, original vs. reprint, the UP主's post text and the UP主's follower count.
- 💬 **Scrape Bilibili comments.** Pinned comment, top comments, likes, reply counts, whether the UP主 liked or replied, commenter level, VIP and verification, and the reply threads.
- 📺 **Download danmaku (弹幕).** Every bullet comment Bilibili serves for the video, each with the exact second it appears on screen, display mode, color and send time.
- 👤 **Scrape UP主 profiles.** Fans, following, level, verification, VIP status, number of videos and total likes.
- 📚 **List an UP主's whole catalogue.** Every public video from a creator, newest first, with full stats.
- 📈 **Track what's trending.** The 热门 popular feed with each video's recommendation reason and upload location, or the 热搜 hot-search terms with rank and heat score.
- 📅 **Schedule and monitor.** Run daily or hourly with [Apify Schedules](https://docs.apify.com/platform/schedules) to track trends, creators or keyword rankings over time.
- 🔌 **API and integrations.** Use the [Apify API](https://docs.apify.com/api/v2), or send results to Google Sheets, Zapier, Make, Slack or webhooks with [Apify integrations](https://docs.apify.com/platform/integrations). Export as JSON, CSV, Excel, XML or HTML.

### What data can you extract from Bilibili?

Every row carries `searchType`, plus what produced it (`keyword`, `video`, `uid` or `trendType`).

| Group | Fields |
|-------|--------|
| Video (search, video-detail, user-videos, trend) | `bvid` · `aid` · `title` · `desc` · `url` · `cover` · `duration` (seconds) · `category` (分区) · `category_id` · `tags` · `pubdate` · `published_at` · `part_count` · `rank` |
| Video stats | `view_count` · `like_count` · `coin_count` (投币) · `favorite_count` (收藏) · `share_count` · `danmaku_count` · `reply_count` |
| Owner (every video) | `owner.mid` · `owner.name` · `owner.avatar` |
| Video detail only | `cid` · `parts[]` (cid, page, title, duration of each 分P) · `dimension` (width, height, rotate) · `copyright` (1 original, 2 reprint) · `dynamic` (the UP主's post text) · `owner_fans` |
| Trending videos only | `rcmd_reason` (why it is trending) · `pub_location` (发布地) · `cid` |
| Comment | `rpid` · `content` · `pictures` · `like_count` · `reply_count` · `ctime` · `created_at` · `root` · `parent` · `oid` · `is_pinned` · `up_liked` · `up_replied` · `user_level` · `user_vip` · `user_verified` · `user` (mid, name, avatar) · `replies[]` |
| Danmaku (弹幕) | `dmid` · `text` · `progress` (seconds into the video) · `mode` (1–3 scrolling, 4 bottom, 5 top) · `fontsize` · `color` (decimal RGB) · `ctime` · `pool` · `sender_hash` · `cid` · `page` |
| UP主 profile | `mid` · `name` · `avatar` · `sign` · `sex` · `level` · `fans` · `following` · `friends` · `verified` · `verify_type` · `verify_desc` · `vip` · `vip_type` · `video_count` · `article_count` · `likes` · `is_senior_member` · `url` |
| Hot-search term (热搜) | `rank` · `keyword` · `show_name` · `heat_score` · `icon` · `search_url` |

Fields Bilibili doesn't send for a given mode are `null`. Search results have no coin or share counts, UP主 catalogue rows have no tags or category name (only `category_id`), and trending rows have no tags. Use **video-detail** on those videos to fill them in.

### How to scrape Bilibili

1. Open [Bilibili 哔哩哔哩 Scraper](https://apify.com/parsebird/bilibili-scraper) on Apify Store and click **Try for free**.
2. Choose a **Mode**: search, video details, comments, danmaku, UP主 profile, UP主 videos or trending.
3. Fill in the field that mode uses: **Search keywords**, **Video URLs or BV ids**, or **UP主 space URLs or UIDs**. Trending needs no input.
4. Set **Max results per keyword or target**. The default of 20 keeps the first run cheap.
5. Optionally narrow a search with the sort, length and date filters.
6. Click **Start**. When the run finishes, open the **Output** tab and download the data as JSON, CSV, Excel, XML or HTML, or read it with the API.

#### Search a keyword, most-played first

```json
{
    "searchType": "search",
    "keywords": ["编程", "机械键盘"],
    "sortOrder": "click",
    "maxItems": 50
}
```

One row per video, with plays, likes, favourites, danmaku and comment counts. `sortOrder` accepts `totalrank` (best match), `click` (most played), `pubdate` (newest), `dm` (most danmaku) and `stow` (most favourited).

#### Narrow a search by date and length

```json
{
    "searchType": "search",
    "keywords": ["AI"],
    "publishedAfter": "2026-01-01",
    "publishedBefore": "2026-06-30",
    "durationFilter": "medium",
    "maxItems": 100
}
```

`publishedAfter`, `publishedBefore` and `durationFilter` are sent to Bilibili as part of the search, so a narrow search returns and bills fewer videos than a broad one. Dates are in China Standard Time.

#### Full details for specific videos

```json
{
    "searchType": "video-detail",
    "videoUrls": ["https://www.bilibili.com/video/BV1rpWjevEip", "BV1Mbx163Exi"]
}
```

#### Audience reaction, second by second (danmaku / 弹幕)

```json
{
    "searchType": "danmaku",
    "videoUrls": ["https://www.bilibili.com/video/BV1rpWjevEip"]
}
```

One row per bullet comment, each with `progress`, the second it appears on screen, so you can line reactions up against the moments that caused them. Billed once per video, not per bullet. For a multi-part video, add `?p=3` to the URL to get part 3; without it you get part 1.

#### Comments with reply threads

```json
{
    "searchType": "comments",
    "videoUrls": ["BV1rpWjevEip"],
    "maxItems": 200,
    "includeReplies": true
}
```

Each comment carries the commenter's level, VIP and verification status, and whether the UP主 liked or replied to it. With `includeReplies` off, each comment still includes Bilibili's reply previews at no extra cost. With it on, the replies in each thread are saved and billed as comments. See the FAQ for how many comments Bilibili shows.

#### A creator (UP主) and their whole catalogue

```json
{
    "searchType": "user-videos",
    "userUrls": ["https://space.bilibili.com/546195", "178360345"],
    "maxItems": 500
}
```

Switch `searchType` to `profile` on the same input to get the creator card instead: fans, following, level, verification and VIP.

#### What is trending right now

```json
{ "searchType": "trend", "trendType": "videos", "maxItems": 50 }
```

`trendType: "videos"` returns the 热门 feed with each video's recommendation reason. `"keywords"` returns the 热搜 terms with their rank and heat score.

### Input parameters

Pick a mode in `searchType`. Every other field belongs to one or more modes and is ignored by the rest. See the [Input tab](https://apify.com/parsebird/bilibili-scraper/input-schema) for the full form.

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `searchType` | string | **Yes** | `search` | The mode: `search`, `video-detail`, `comments`, `danmaku`, `profile`, `user-videos`, `trend` |
| `keywords` | string\[] | For search | — | Search terms. Used by search |
| `videoUrls` | string\[] | For video modes | — | Video URLs, BV ids, av ids or b23.tv short links. Used by video-detail, comments, danmaku |
| `userUrls` | string\[] | For UP主 modes | — | UP主 space URLs or numeric UIDs. Used by profile and user-videos |
| `maxItems` | integer | No | `20` | Results per keyword, video or UP主, up to 5,000. Applies to search, comments, user-videos and trend |
| `sortOrder` | string | No | `totalrank` | `totalrank`, `click`, `pubdate`, `dm`, `stow`. Search only |
| `durationFilter` | string | No | `any` | `short` (under 10 min), `medium` (10–30), `long` (30–60), `verylong` (over 60). Search only |
| `publishedAfter` | string | No | — | YYYY-MM-DD. Search only |
| `publishedBefore` | string | No | — | YYYY-MM-DD. Search only |
| `trendType` | string | No | `videos` | `videos` (热门) or `keywords` (热搜). Trend only |
| `includeReplies` | boolean | No | `false` | Fetch reply threads. Each reply is billed as one comment and counts against `maxItems`. Comments only |
| `proxyConfiguration` | object | No | none | Not needed for normal use |

⚠️ **Accepted video and creator references.** A video is a full URL (`https://www.bilibili.com/video/BV1rpWjevEip`), a bare BV id (`BV1rpWjevEip`), an av id (`av113006243481679`) or a b23.tv short link. A creator is a space URL (`https://space.bilibili.com/546195`) or a bare numeric UID (`546195`). Anything else is skipped with a warning and not charged. Duplicate keywords, videos or UIDs in the same input are collapsed before the run starts, so pasting the same target twice never charges twice.

### Output example

Each result is one row. These are real rows, with long text shortened.

**Search result**

```json
{
    "searchType": "search",
    "keyword": "编程",
    "rank": 1,
    "bvid": "BV1rpWjevEip",
    "aid": "113006243481679",
    "title": "【全748集】目前B站最全最细的Python零基础全套教程，2026最新版…",
    "url": "https://www.bilibili.com/video/BV1rpWjevEip",
    "cover": "https://i2.hdslb.com/bfs/archive/a979056b1a32012cdd00d48fbc3732d253e30620.jpg",
    "duration": 143894,
    "category": "计算机技术",
    "category_id": 231,
    "tags": ["程序员", "Python教程", "Python入门零基础", "计算机", "编程语言"],
    "pubdate": 1724338758,
    "published_at": "2024-08-22T14:59:18Z",
    "view_count": 21428872,
    "like_count": 590710,
    "coin_count": null,
    "favorite_count": 908362,
    "share_count": null,
    "danmaku_count": 135330,
    "reply_count": 368115,
    "owner": { "mid": "3546597933714079", "name": "Python官方课程", "avatar": "https://i1.hdslb.com/bfs/face/6822e4fdc8f82c69e10accd1ab11a109702bccbf.jpg" }
}
```

**Danmaku (弹幕)**

```json
{
    "searchType": "danmaku",
    "video": "BV1Mbx163Exi",
    "page": 1,
    "cid": "43210768827",
    "dmid": "2234373449811002368",
    "text": "刚刚！",
    "progress": 0,
    "mode": 5,
    "fontsize": 25,
    "color": 16777215,
    "ctime": 1793449271,
    "pool": 0,
    "sender_hash": "5cc3a9ff"
}
```

**UP主 profile**

```json
{
    "searchType": "profile",
    "uid": "546195",
    "name": "老番茄",
    "sign": "新浪微博：_老番茄_",
    "sex": "男",
    "level": 6,
    "fans": 20866651,
    "following": 7,
    "verified": true,
    "verify_type": "personal",
    "verify_desc": "2025百大UP主、2025年度商业影响力奖UP主、2022年度联合创作奖UP主",
    "vip": true,
    "video_count": 683,
    "likes": 196641782,
    "url": "https://space.bilibili.com/546195"
}
```

**Hot-search term (热搜)**

```json
{
    "searchType": "trend",
    "trendType": "keywords",
    "rank": 1,
    "keyword": "北京JDG 重庆狼队",
    "show_name": "北京JDG vs 重庆狼队 KPL",
    "heat_score": 18717327,
    "search_url": "https://search.bilibili.com/all?keyword=%E5%8C%97%E4%BA%ACJDG%20%E9%87%8D%E5%BA%86%E7%8B%BC%E9%98%9F"
}
```

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

Bilibili 哔哩哔哩 Scraper uses **pay-per-event** pricing. You pay only for results saved to your dataset. Compute and proxy costs are included in the event prices, and lookups that return nothing (a deleted video, an unknown UID, a video with no danmaku) are free.

| Event | What it counts | Free | Bronze | Silver | Gold |
|-------|----------------|------|--------|--------|------|
| Video | Each video from keyword search or an UP主's catalogue | $9.99 | $8.99 | $7.99 | $7.49 |
| Video detail | Each full video detail (stats, owner, parts, cid) | $19.99 | $17.99 | $16.99 | $15.99 |
| Comment | Each comment or reply saved | $7.99 | $6.99 | $5.99 | $5.49 |
| UP主 profile | Each creator profile | $11.99 | $10.99 | $9.99 | $8.99 |
| Danmaku 弹幕 | Each video whose danmaku is returned, however many bullets | $10.99 | $9.99 | $8.99 | $7.99 |
| Trending | Each trending video or hot-search term | $7.99 | $6.99 | $5.99 | $5.49 |

Prices are per 1,000 events. On the Free plan, 500 search results cost about $5.00, details for 100 videos cost $2.00, and danmaku for 10 videos costs $0.11 even if those videos return 10,000 bullets.

`maxItems` is the main cost lever for the list modes, because they bill per result: a run costs roughly price × results × targets. video-detail and profile return one row per target. You can also set a maximum cost per run in Apify Console, and the Actor stops when it's reached.

### Use the Bilibili API from Python or JavaScript

Get your API token from [Apify Console](https://console.apify.com/settings/integrations), then call the Actor with the [Apify API client](https://docs.apify.com/api/client/python).

**Python**

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")

run = client.actor("parsebird/bilibili-scraper").call(run_input={
    "searchType": "search",
    "keywords": ["机械键盘"],
    "sortOrder": "click",
    "maxItems": 100,
})

for video in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(video["title"], video["view_count"], video["owner"]["name"])
```

**JavaScript**

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });

const run = await client.actor('parsebird/bilibili-scraper').call({
    searchType: 'danmaku',
    videoUrls: ['https://www.bilibili.com/video/BV1rpWjevEip'],
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(`${items.length} danmaku`, items[0]);
```

The full endpoint reference, including synchronous runs that return the dataset in one call, is on the [API tab](https://apify.com/parsebird/bilibili-scraper/api).

### Use cases

- **Market and trend research.** Follow what Chinese audiences watch in a category through keyword searches sorted by plays or favourites, the 热门 feed and the 热搜 terms.
- **Influencer and KOL discovery.** Find UP主 in a niche from search results, then pull their profiles and full catalogues to compare fans, likes and engagement.
- **Brand and product monitoring.** Schedule keyword searches sorted by newest to catch new videos about your brand, product or competitors.
- **Audience reaction analysis.** Line danmaku up against the video timeline to find the exact moments viewers react to, and read the top comments.
- **Content strategy.** Compare engagement ratios (coins, favourites and likes per view) across an UP主's videos to see which formats work.
- **Datasets for research and NLP.** Collect Chinese-language comments, danmaku and video metadata for sentiment analysis or language research.

### How it works

1. The Actor reads your mode and turns each keyword, video link or UID into a target. Invalid inputs are skipped and duplicates are merged.
2. It queries Bilibili's public web endpoints, the same ones bilibili.com uses for logged-out visitors, and paginates until it reaches `maxItems` or the end of the list.
3. Each result is normalised into a flat row with consistent field names, string IDs (some Bilibili IDs exceed JavaScript's safe integer range) and ISO dates next to the Unix timestamps.
4. Rows are saved to the dataset and charged as they come in. The run stops cleanly at your spending limit, and resumes without duplicates if Apify moves it to another server.

### FAQ

**Do I need a Bilibili account, cookie or API key?**
No. The Actor reads public data the way a logged-out visitor sees it.

**How many comments can I get per video?**
Bilibili shows only a handful of comments to logged-out visitors, so that is what this Actor returns. It merges Bilibili's hot, newest and featured views, which usually gives 5–10 top-level comments per video plus the pinned comment. With `includeReplies` on, it also returns up to 20 replies per thread. The run log shows how many comments the video has in total. For videos with thousands of comments this is a sample of the most visible ones, not the full thread.

**How many danmaku does a video return?**
The video's current danmaku pool, as Bilibili serves it to viewers. Its size depends on the video's length and popularity: in testing, a 2-minute clip returned all 390 of its danmaku, while a long tutorial part returned 3,600. The run log shows the pool size for each video. For very popular videos this is the most recent pool, not every bullet ever sent.

**Why does a search stop before maxItems?**
Bilibili's search returns at most about 1,000 results per query, and its pages overlap, so one search typically yields 700–1,000 unique videos. To collect more, split the search with `publishedAfter` and `publishedBefore`, for example one run per month.

**Why is `category` empty on video-detail rows?**
Bilibili's video detail endpoint no longer sends the category name, only its numeric ID (`category_id`). Search and trending rows do include the name.

**Can I get video transcripts or subtitles?**
No. Bilibili hides subtitle files from logged-out visitors, so this Actor doesn't offer them.

**Does it download the videos?**
No. It extracts metadata, statistics, comments and danmaku. Cover image URLs are included.

**Can I scrape a specific part of a multi-part video?**
Yes, for danmaku. Add `?p=N` to the video URL. video-detail returns every part with its cid and title.

**Can I schedule recurring runs?**
Yes. Use [Apify Schedules](https://docs.apify.com/platform/schedules) to run hourly, daily or weekly, for example to track the 热搜 list or an UP主's new uploads.

**Can I use it with Make, Zapier, Google Sheets or an AI agent?**
Yes, through [Apify integrations](https://docs.apify.com/platform/integrations) and the [Apify API](https://docs.apify.com/api/v2). The Actor is also available to AI agents through the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp).

**Something doesn't work. What should I do?**
Open an issue on the [Issues tab](https://apify.com/parsebird/bilibili-scraper/issues) with your run link. We read every report.

### Is it legal to scrape Bilibili?

This Actor only collects publicly available data that any logged-out visitor can see on bilibili.com. It doesn't log in, bypass paywalls or access private content. Comments, danmaku and profiles can still include personal data, which is protected by laws such as the GDPR and China's PIPL. Don't scrape personal data unless you have a legitimate reason, and check Bilibili's terms of service before you use the data. If you're unsure, consult a lawyer. Read more in Apify's guide: [Is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/)

### Related Actors

| Actor | What it does |
|-------|--------------|
| [YouTube Search Scraper & API](https://apify.com/parsebird/youtube-search-scraper) | YouTube search results: videos, channels, playlists and Shorts with views and channel info |
| [YouTube Trending Videos Scraper](https://apify.com/parsebird/youtube-trending-videos-scraper) | YouTube's trending pages (Gaming, Music, News and more) for any country |
| [YouTube Live Chat Scraper](https://apify.com/parsebird/youtube-live-chat-scraper) | Live chat messages, Super Chats and membership events from live or replayed streams |
| [YouTube Transcript Scraper](https://apify.com/parsebird/youtube-transcript-scraper) | Transcripts and subtitles from YouTube videos, with timestamps |
| [TikTok Trends Scraper](https://apify.com/parsebird/tiktok-trends-scraper) | Trending hashtags, sounds, creators and videos on TikTok |
| [Twitch Scraper](https://apify.com/parsebird/twitch-scraper) | Twitch channels, live streams, clips, games and VODs |
| [NetEase Cloud Music Scraper](https://apify.com/parsebird/netease-cloud-music-scraper) | Toplists and playlists from NetEase Cloud Music (网易云音乐) |
| [Sogou WeChat Article Search Scraper](https://apify.com/parsebird/sogou-wechat-search-scraper) | WeChat Official Account articles from Sogou WeChat (搜狗微信) search |
| [Taobao & Tmall Scraper](https://apify.com/parsebird/taobao-tmall-scraper) | Taobao and Tmall (淘宝 天猫) products by keyword, category, URL or shop |
| [che168 二手车 Autohome Scraper](https://apify.com/parsebird/che168-scraper) | Used car listings from che168.com (二手车之家) |

# Changelog

This Actor's version history is a separate document: https://apify.com/parsebird/bilibili-scraper/changelog.md

# Actor input Schema

## `searchType` (type: `string`):

Choose what to scrape. <b>search</b>, <b>user-videos</b> and <b>trend</b> return videos (or hot-search terms); <b>video-detail</b>, <b>comments</b> and <b>danmaku</b> take video URLs; <b>profile</b> and <b>user-videos</b> take UP主 space URLs or UIDs.

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

Enter search terms in Chinese or English, one per line. Each keyword is searched separately. Used by <b>search</b>.

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

Add video links such as <code>https://www.bilibili.com/video/BV1rpWjevEip</code>, bare BV ids (<code>BV1rpWjevEip</code>), av ids or b23.tv short links. Add <code>?p=2</code> to a URL to pick a part of a multi-part video for danmaku. Used by <b>video-detail</b>, <b>comments</b> and <b>danmaku</b>.

## `userUrls` (type: `array`):

Add creator space links such as <code>https://space.bilibili.com/546195</code> or bare numeric UIDs (<code>546195</code>). Used by <b>profile</b> and <b>user-videos</b>.

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

Set how many videos, comments or trending rows to save for each keyword, video or UP主. This is the main cost lever. Bilibili search returns at most about 1,000 videos per keyword; use the date filters to go further. Ignored by video-detail, profile and danmaku, which return one record set per target.

## `sortOrder` (type: `string`):

Order of keyword search results. Used by <b>search</b>.

## `durationFilter` (type: `string`):

Keep only videos of this length. Used by <b>search</b>.

## `publishedAfter` (type: `string`):

Keep only videos published on or after this date (China Standard Time). Used by <b>search</b>.

## `publishedBefore` (type: `string`):

Keep only videos published on or before this date (China Standard Time). Used by <b>search</b>.

## `trendType` (type: `string`):

<b>videos</b> returns the 热门 (popular) feed with each video's recommendation reason; <b>keywords</b> returns the 热搜 hot-search terms with rank and heat score. Used by <b>trend</b>.

## `includeReplies` (type: `boolean`):

Turn on to fetch the replies under each comment (up to 20 per thread, the number Bilibili shows logged-out visitors). Each reply is saved and billed as one comment and counts against Max results. When off, each comment still includes Bilibili's reply previews at no extra cost. Used by <b>comments</b>.

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

Not needed for normal use. Only set a proxy if your runs are being throttled.

## Actor input object example

```json
{
  "searchType": "search",
  "keywords": [
    "编程"
  ],
  "maxItems": 20,
  "sortOrder": "totalrank",
  "durationFilter": "any",
  "trendType": "videos",
  "includeReplies": 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 = {
    "searchType": "search",
    "keywords": [
        "编程"
    ],
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("parsebird/bilibili-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 = {
    "searchType": "search",
    "keywords": ["编程"],
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("parsebird/bilibili-scraper").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 '{
  "searchType": "search",
  "keywords": [
    "编程"
  ],
  "maxItems": 20
}' |
apify call parsebird/bilibili-scraper --silent --output-dataset

```

## MCP server setup

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

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/ZShgwpDyKDFCfFAd4/builds/6HHVwqOtXlxx3hcy3/openapi.json
