Home › Blog

Bilibili · 哔哩哔哩 · B站

How to Scrape Bilibili Comments, Danmaku and UP主 Data in Python (2026, No Login)

Scrape Bilibili comments, danmaku and UP主 data in Python

⚡ Key takeaways

  • Bilibili has no official API for comments; old tutorials break on the new w_rid signing.
  • The open-source Bilibili Scraper handles signing and risk control, so it works without a login.
  • 1,000 comments with full reply threads cost $1 on Apify, or nothing if you self-host.
  • Export to Excel, CSV or JSON in one click, or use it as a Python library.

Bilibili (哔哩哔哩, B站) is where China's Gen Z watches anime, gaming, tech and lifestyle videos, and its comment sections are brutally honest. Add danmaku (弹幕), the bullet comments that fly across the video at the exact second something happens, and you have one of the richest audience-reaction datasets on the internet.

Getting it out is the hard part. Bilibili has no official public API, its endpoints now demand a w_rid / wts signature (WBI signing), and it answers fast or unsigned requests with silent risk-control errors (-352, -412). Most tutorials from before 2023 simply don't work anymore.

Here are two ways that do work in 2026, without a Bilibili account.

Bilibili Scraper logo
Bilibili ScraperComments with replies, danmaku, videos, UP主 profiles and subtitles in one tool. No login.Comments $1 / 1,000 · Danmaku $0.05 / 1,000 · Open source
Try it free →

What can you scrape from Bilibili?

Data What you get
Comments Hot or newest first, with full nested reply threads. 23 fields per comment: user, likes, pinned, VIP, verified, "liked by uploader", IP location, reply count…
Danmaku (bullet comments) Every bullet comment as its own row, with its playback time, colour, mode and send time
Videos Views, likes, coins, favourites, shares, danmaku and reply counts, tags
UP主 (creators) Name, bio, level, verified title, VIP, followers, following, video count, total likes
Creator uploads Every video a creator uploaded, sorted by date, views or favourites
Search & trending Keyword search (sort by views, date, danmaku…), the popular feed and the top-100 ranking
Subtitles / transcripts Including AI captions. This is the one thing that needs a login cookie

Option 1: No code, in 4 clicks (Apify)

  1. Open the Bilibili Scraper and click Try for free. A free Apify account includes monthly credit.
  2. Pick What to scrape: videos, comments, danmaku, subtitles or users.
  3. Give it a source: paste video links, space.bilibili.com/... creator links or search links, or just type keywords such as 原神.
  4. Click Start, then Export to Excel, CSV or JSON (or send it straight to Google Sheets).

Example: the comments, with replies, on the top 20 search results for a keyword:

{
  "mode": "comments",
  "searchQueries": ["原神"],
  "maxVideosPerSource": 20,
  "maxCommentsPerVideo": 200,
  "includeReplies": true
}

How do you scrape UP主 (creator) profiles?

Set mode to users and pass creator IDs (the number in space.bilibili.com/<UID>):

{
  "mode": "users",
  "userIds": ["2", "546195"]
}

Each row has name, sign (bio), level, verified, vip, followers, following, videos, likes and the profile url. To get a creator's videos instead, use mode: "videos" with the same userIds.

What does it cost?

Pay per result, no subscription:

You scrape Price per 1,000
Comments (incl. replies) $1
Danmaku $0.05
Videos or UP主 profiles $2
Subtitles $3

Option 2: Python (free, open source)

The scraper is open source (MIT):

git clone https://github.com/Dunkmap/Bilibili-Scraper
cd Bilibili-Scraper
pip install -e .

From the command line:

bili comments BV1xx411c7mD --replies -o comments.csv
bili danmaku BV1xx411c7mD -o danmaku.csv
bili user 2                                   # UP主 profile
bili uploads 2 --order click --limit 100 -o uploads.csv
bili search "原神" --order click --limit 200 -o search.csv

Or as a library:

import asyncio
from bilibili_scraper import Scraper

async def main():
    async with Scraper(rate=4) as s:
        video = await s.video("BV1xx411c7mD")
        async for c in s.comments(video["bvid"], limit=500, replies=True):
            print(c["uname"], c["content"])

        creator = await s.user(video["owner_mid"])
        print(creator["name"], creator["followers"])

        async for v in s.user_videos(video["owner_mid"], order="click", limit=20):
            print(v["title"], v["views"])

asyncio.run(main())

How does it get past w_rid signing and risk control?

  • WBI signing: fetches img_key / sub_key, generates w_rid and wts, caches the keys and refreshes them when Bilibili rejects a signature (-352).
  • Silent risk control: Bilibili sometimes answers code: 0 with only a v_voucher and no data. The scraper detects this and retries instead of treating it as an empty page.
  • Device cookies: generates a buvid itself, so no account is needed.
  • Rate limits: jittered delays and backoff retries on -412. The cloud version also switches to a proxy when it gets blocked.

Want the details? Read how the Bilibili API works.

What else can it do?

  • Sentiment analysis: label every comment and danmaku positive, neutral or negative ($2 per 1,000 labels, using your own free Groq API key).
  • Delta mode: scheduled runs return only items that are new since the last run, which is handy for brand monitoring.
  • Danmaku highlights: if you analyse bullet comments, the Bilibili Danmaku Scraper adds a keyword filter and a free per-video highlight timeline. New to danmaku? Start with what is danmaku.

Not sure which tool fits? See the comparison of Bilibili scrapers on Apify.

Bilibili Scraper logo
Bilibili ScraperComments with replies, danmaku, videos, UP主 profiles and subtitles in one tool. No login.Comments $1 / 1,000 · Danmaku $0.05 / 1,000 · Open source
Try it free →

FAQ

Frequently asked questions

Is there an official Bilibili API?

No public one for comments or danmaku. This scraper uses the same web endpoints bilibili.com uses and handles their WBI signing for you.

Can I read Bilibili comments without an account?

Yes. Comments, danmaku, videos, search, creators and trending all work logged out. Only subtitles need a login cookie.

Why does Bilibili only show 3 comments when I'm not logged in?

Once a logged-out browser has Bilibili's device cookie, the comment API returns only the top few comments. The Bilibili Scraper requests comment pages without that cookie, so it pages through the full list, replies included, without a login.

How much does it cost to scrape 1,000 Bilibili comments?

$1 on Apify with the Bilibili Scraper, with no subscription. Self-hosting the open-source version is free.

How do I generate the w_rid parameter?

You don't have to. The scraper signs every request itself with Bilibili's WBI keys.

Can I export Bilibili comments to Excel?

Yes. On Apify, click Export and choose Excel. Locally, use -o comments.csv and open the file in Excel.

Is scraping Bilibili legal?

It reads public data the same way the bilibili.com website does. Follow Bilibili's terms of service, keep the request rate reasonable and don't republish personal data.

Want the data without writing code? The Bilibili Scraper exports comments, danmaku, videos and UP主 profiles to Excel, CSV or JSON. Pay per result, no login.