Bilibili Scraper: Video Search, Comments & Danmaku (B站) avatar

Bilibili Scraper: Video Search, Comments & Danmaku (B站)

Pricing

Pay per event

Go to Apify Store
Bilibili Scraper: Video Search, Comments & Danmaku (B站)

Bilibili Scraper: Video Search, Comments & Danmaku (B站)

Bilibili scraper for video search by keyword, full video details, comments with IP location and danmaku (bullet comments). Views, likes, coins, tags and uploader per video. Plain HTTP, no browser, no login. $8 per 1,000 videos, $2 per 1,000 comments.

Pricing

Pay per event

Rating

0.0

(0)

Developer

Data Gleaner

Data Gleaner

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

a day ago

Last modified

Share

Bilibili Scraper: videos, comments and danmaku (B站)

Bilibili scraper for video search by keyword, video stats, comments with IP location and danmaku (bullet comments), exported to JSON, CSV or Excel. $8 per 1,000 videos, against about $20 elsewhere, with comment IP location, raw danmaku with timestamps, and no login or browser.

It works on Bilibili (哔哩哔哩, bilibili.com), China's largest video platform. Search videos by keyword, get full details (views, likes, coins, favorites, tags, uploader) for specific videos by link or BV id, and scrape comments, replies and danmaku. Plain HTTP against Bilibili's own web API, with the request signing handled for you. No cookies needed.

What you can do with it

  • Creator and brand research: find who is making videos about your product or niche, and how well they perform (views, likes, coins, favorites, shares).
  • China social listening: read what Chinese viewers actually say in comments, including the city or province they post from.
  • Trend tracking: search by newest or by most views, and watch which topics and tags take off.
  • LLM and research datasets: titles, descriptions, tags and comment text in Chinese, with timestamps, ready for analysis.

Input

FieldMeaningDefault
searchKeywordsKeywords to search (Chinese works best)none
searchOrdertotalrank relevance, click most views, pubdate newest, dm most danmaku, stow most favorites, scores most commentstotalrank
durationFilterSearch only: any, under10, 10to30, 30to60, over60 (minutes)any
publishedAfter, publishedBeforeSearch only: keep videos published in a range. Accepts 2026-01-31 (a whole day in China time), an ISO datetime, or a relative age such as 7 days for a rolling window on scheduled runsnone
trendingCategorypopular also returns Bilibili's site-wide trending feed (综合热门, a few hundred videos), no keyword needed, with coins and shares included (tags stay empty unless enrichSearchResults is on). Works alone or with keywords and URLsnone
maxItemsMax videos per keyword or trending list (search ends near 1,000)30
enrichSearchResultsFetch each search hit's full record (adds coins, shares, exact category, full tags) at 2 extra requests per videooff
videoUrlsVideo links, BV ids (BV1xx411c7mD) or av ids (av170001)none
includeCommentsAlso scrape comments for every videooff
maxCommentsPerVideoTop-level comments per video20
commentSorthot or newesthot
includeReplies, maxRepliesPerCommentAlso scrape replies under each commentoff, 10
includeDanmakuAlso scrape danmaku (bullet comments, 弹幕) for every videooff
maxDanmakuPerVideoDanmaku per video, across all its parts1000
requestDelaySecsPause between requests, with random jitter1.5
sessionCookieOptional SESSDATA cookie of your own Bilibili account, for full comment depth (see Limits)none
proxyConfigurationOptional proxynone

Provide at least one of searchKeywords, videoUrls or trendingCategory. With no input at all, the Actor runs a built-in 5-video example for python 教程.

Search and comments for 50 videos:

{
"searchKeywords": ["python 教程"],
"searchOrder": "click",
"maxItems": 50,
"includeComments": true,
"maxCommentsPerVideo": 40
}

Trending videos, no keyword:

{ "trendingCategory": "popular", "maxItems": 50 }

Videos from the last 7 days that run 10 to 30 minutes:

{ "searchKeywords": ["露营装备"], "publishedAfter": "7 days", "durationFilter": "10to30" }

Specific videos with full details:

{ "videoUrls": ["https://www.bilibili.com/video/BV1xx411c7mD", "BV1rpWjevEip"] }

Output

One dataset, three item types, told apart by type. The Videos, Comments and Danmaku views in the Console show each as a table.

Video:

{
"type": "video",
"bvid": "BV1rpWjevEip",
"aid": 113006243481679,
"url": "https://www.bilibili.com/video/BV1rpWjevEip",
"title": "【全748集】目前B站最全最细的Python零基础全套教程",
"description": "本套教程从零开始讲解……",
"tags": ["程序员", "Python教程", "Python入门零基础"],
"category": "计算机技术",
"durationSec": 143894,
"publishedAt": "2024-08-22T14:59:18Z",
"stats": { "views": 20516496, "danmaku": 132072, "comments": 356871, "likes": 563224, "coins": null, "favorites": 866293, "shares": null },
"owner": { "mid": 3546597933714079, "name": "Python官方课程", "face": "https://i1.hdslb.com/bfs/face/6822e4fdc8f8.jpg" },
"thumbnailUrl": "https://i2.hdslb.com/bfs/archive/a979056b1a32.jpg",
"publishedTimestamp": 1724338758,
"source": "search",
"sourceQuery": "python 教程",
"scrapedAt": "2026-10-08T12:00:00Z"
}

Search results do not carry coins, shares or the exact category, so those are null (or the search category name) unless you turn on enrichSearchResults or pass the video through videoUrls.

Comment:

{
"type": "comment",
"rpid": 123456789,
"videoBvid": "BV1xx411c7mD",
"videoAid": 2,
"url": "https://www.bilibili.com/video/BV1xx411c7mD#reply123456789",
"text": "经典老视频",
"likes": 88,
"createdAt": "2023-11-14T22:13:20Z",
"replyCount": 3,
"parentRpid": null,
"author": { "mid": 4242, "name": "测试用户", "level": 5 },
"ipLocation": "上海",
"createdTimestamp": 1699999999,
"scrapedAt": "2026-10-08T12:00:00Z"
}

parentRpid is set on replies. ipLocation is the province or country Bilibili shows next to the comment, when present.

Danmaku (one item per bullet comment):

{
"type": "danmaku",
"bvid": "BV1xx411c7mD",
"cid": 62131,
"part": 1,
"videoTitle": "字幕君交流场所",
"text": "经典老视频",
"timeInVideoSeconds": 12.345,
"mode": 1,
"fontSize": 25,
"color": "#ffffff",
"sentAt": "2009-09-09T01:10:00Z",
"senderHash": "a1b2c3d4",
"danmakuId": "1001",
"scrapedAt": "2026-10-08T12:00:00Z"
}

mode is the display type (1 scrolling, 4 bottom, 5 top, 6 reverse, 7 positioned, 8 code). senderHash is Bilibili's hashed sender id, not a user id.

Output fields

FieldRowsMeaning
typeallvideo, comment or danmaku
bvid, aid, urlvideoBV id, numeric av id, link
title, description, tags, categoryvideoText fields; category is Bilibili's 分区
durationSecvideoLength in seconds
publishedAt, publishedTimestampvideoPublish time, ISO UTC and Unix seconds
statsvideoviews, danmaku, comments, likes, coins, favorites, shares
ownervideoUploader mid, name, face
thumbnailUrlvideoCover image
source, sourceQueryvideoWhich input produced it: search, trending or videoUrl, and the keyword, category or URL
rpid, videoBvid, videoAid, parentRpidcommentComment id, its video, and the parent comment for replies
text, likes, replyCountcommentContent and counters
createdAt, createdTimestampcommentComment time, ISO UTC and Unix seconds
authorcommentmid, name, account level (0-6)
ipLocationcommentCommenter's IP location (IP属地)
cid, part, videoTitle, timeInVideoSeconds, mode, fontSize, color, sentAt, senderHash, danmakuIddanmakuRaw bullet comment with its playback time
scrapedAtallWhen the Actor collected the item, ISO UTC

How much does it cost to scrape Bilibili? (pay per event)

EventPrice
video$8 per 1,000 videos ($0.008 each)
comment$2 per 1,000 comments ($0.002 each, replies included)
danmaku$0.50 per 1,000 danmaku ($0.0005 each)

You pay only for items actually delivered. The Actor respects the maximum cost you set for a run and stops cleanly when it is reached.

Example: 100 videos with 40 comments each (logged-in comment depth) is 100 x $0.008 + 4,000 x $0.002 = $8.80. Without a sessionCookie, expect about 4 comments per video, so the same run costs about $1.60.

Example with danmaku: 20 videos with up to 1,000 danmaku each is 20 x $0.008 + 20,000 x $0.0005 = $10.16.

Use with Python

# pip install apify-client
from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("datagleaner/bilibili-scraper").call(
run_input={"searchKeywords": ["python 教程"], "searchOrder": "click", "maxItems": 5}
)
for item in client.dataset(run.default_dataset_id).iterate_items():
print(item["title"], item["stats"]["views"], item["url"])

Five videos cost $0.04.

Use with JavaScript / Node.js

// npm install apify-client
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('datagleaner/bilibili-scraper').call({
searchKeywords: ['python 教程'],
searchOrder: 'click',
maxItems: 5,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
for (const item of items) console.log(item.title, item.stats.views, item.url);

Use it from n8n, Make, Zapier or an AI agent

Actor ID: datagleaner/bilibili-scraper

Minimal input:

{
"searchKeywords": ["python 教程"],
"maxItems": 5
}

Each tool below runs this Actor with your own Apify API token.

  • n8n: add the Apify node (@apify/n8n-nodes-apify). On n8n Cloud you install it from the community node registry. Choose Run an Actor and get dataset, set Actor to datagleaner/bilibili-scraper and paste the input above.

  • Make: use the Apify app's Run an Actor module, then Get Dataset Items to read the results. Watch Actor Runs can trigger a scenario when a run finishes.

  • Zapier: use the Apify action Run Actor, then the search Fetch dataset items. The trigger Finished Actor run starts a Zap when a run ends.

  • AI agents (MCP): connect to https://mcp.apify.com?tools=datagleaner/bilibili-scraper. In Claude Code:

    claude mcp add --transport http apify "https://mcp.apify.com?tools=datagleaner/bilibili-scraper"
    

    Then run /mcp to sign in to Apify in your browser, or send the header Authorization: Bearer YOUR_APIFY_TOKEN. The agent gets this Actor as a ready tool (datagleaner--bilibili-scraper); without preloading it can still find it with the search-actors tool and run it with call-actor. Clients that run local MCP servers (Claude Desktop's mcpServers config) can use Apify's package @apify/actors-mcp-server, run with npx -y and APIFY_TOKEN set. Then ask in plain words, for example:

    Find the 20 most-viewed Bilibili videos for "露营装备", with 10 hot comments each, and summarize which brands viewers mention and which provinces they comment from.

  • LangChain (Python):

# pip install langchain-apify, then set APIFY_TOKEN in your environment
import json
from langchain_apify import ApifyActorsTool
tool = ApifyActorsTool("datagleaner/bilibili-scraper")
result = tool.invoke({"run_input": json.loads('{"searchKeywords": ["python 教程"], "maxItems": 5}')})

Limits

  • Public data only. Nothing that needs a Bilibili login (follower lists, private videos, watch history) is available.
  • Comment depth without login is shallow. Bilibili serves anonymous visitors only about 3 to 4 curated top comments per video. Replies under a comment page normally. For full comment lists, paste the SESSDATA cookie of a Bilibili account you own into sessionCookie (use a throwaway account; this path has not been verified by us yet).
  • Search returns at most about 1,000 results per keyword. Bilibili's comment list is also finite for very large threads.
  • Bilibili rate-limits aggressively, sometimes with a silent empty answer instead of an error (the Actor detects this). The Actor paces requests, renews its session and retries with backoff, but a very large run from a datacenter IP can still be blocked. If that happens, lower the speed (raise requestDelaySecs) or add a proxy.
  • If Bilibili blocks a run completely (no data collected), it ends without charge and with a status message asking you to retry in a few minutes or turn on proxyConfiguration. If the block comes mid-run, everything already collected is kept.
  • Videos that were removed or are region-locked are skipped with a log line.
  • Not included: a user's video list. Bilibili's uploader-page endpoint is behind stricter risk control and failed in testing, so it is left out rather than shipped unreliable.
  • Short b23.tv links are not resolved; use the full URL or the BV id.

FAQ

Is there a Bilibili API for Python? Bilibili has no documented public API for this data. This Actor calls the same web endpoints the website uses, handles the request signing, and returns structured JSON you can fetch from Python or Node.js with apify-client (see above).

Can I use it as a Bilibili comment scraper without an account? Yes: turn on includeComments and give keywords or video links. Each comment has its text, likes, time, reply count and the commenter's IP location. Without an account Bilibili shows only about 3 to 4 top comments per video; for full lists see sessionCookie under Limits.

How do I scrape Bilibili videos by keyword? Put the keywords in searchKeywords, choose searchOrder (relevance, most views, newest, most danmaku, most favorites, most comments) and set maxItems. Search results lack coins and shares; turn on enrichSearchResults or pass the videos through videoUrls to get them.

How many danmaku do I get per video? The public XML returns the most recent danmaku pool, typically up to a few thousand per part, not the full history of a very popular video. Multi-part videos are read part by part until maxDanmakuPerVideo is reached.

Can I download the videos themselves? No. It collects metadata, comments and danmaku, not video files.

Responsible use

Only public data is collected, at a polite pace. You are responsible for using it lawfully: respect Bilibili's terms of service, copyright on video content, and privacy law (comment authors are real people; do not use the data to profile or harass them). Do not use this Actor for spam or to circumvent access controls.

中文简介

抓取哔哩哔哩(Bilibili)公开数据:按关键词搜索视频、按 BV 号或链接获取完整视频信息(标题、简介、标签、分区、时长、播放/弹幕/评论/点赞/投币/收藏/分享数、UP 主)、抓取评论(含 IP 属地)与回复、弹幕(公开 XML,通常为最近的数千条)。无需浏览器、无需登录,已内置 wbi 签名与限流重试。按事件计费:视频 $8 / 1000 条,评论 $2 / 1000 条,弹幕 $0.5 / 1000 条。暂不支持 UP 主视频列表。