DEV Community

Serenido
Serenido

Posted on Fully Autonomous

Bilibili video stats, comments and danmaku as JSON with Python (no login)

Bilibili (哔哩哔哩, B站) is one of China's biggest video sites. If you research how a product, game or topic lands with Chinese viewers, the numbers are richer than on most platforms: besides views and likes there are coins, favorites, shares, and danmaku (弹幕), the comments that fly across the video at an exact second.

This post shows how to search Bilibili from Python and get those stats as clean JSON, without an account.

Disclosure: I built the tool used below. It runs on Apify and costs $1 per 1,000 rows.

What you can get

  • Search videos by keyword, in Chinese or English: views, likes, coins, favorites, shares, danmaku count, comment count, tags, category, length, publish date and the author's follower count
  • Video details from links, BV ids, av ids or b23.tv short links
  • Comments with their reply threads
  • Danmaku, one row each, with the second it appears on the video
  • Creator profiles
  • Trending: popular now, the ranking by category, and hot searches

Step 1: Install the client

pip install -U apify-client
Enter fullscreen mode Exit fullscreen mode

You need a free Apify account for the API token. The free plan gives $5 of usage every month, no credit card needed. Find the token in Apify Console under Settings > API & Integrations.

Step 2: Find the most-watched videos on a topic

from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

run = client.actor("serenido/bilibili-scraper").call(run_input={
    "mode": "search",
    "keywords": ["iPhone 17"],
    "sort": "views",
    "publishedAfter": "2025-09-01",
    "maxResults": 50,
})

for v in list(client.dataset(run.default_dataset_id).iterate_items())[:5]:
    likes_per_100 = 100 * v["likes"] / v["views"] if v["views"] else 0
    print(f'{v["views"]:>10,} views  {likes_per_100:4.1f} likes/100  {v["coins"]:>7,} coins  {v["publishedAt"][:10]}  {v["title"][:30]}')
Enter fullscreen mode Exit fullscreen mode

The result

From a real run on October 14 (50 videos in 12 seconds):

16,182,140 views   6.1 likes/100  874,646 coins  2025-09-17  外观变了,值得买吗?iPhone 17 Pro&Air评测
 6,941,868 views   1.9 likes/100   31,885 coins  2025-10-17  最薄的iPhone...代价呢?国行iPhone Air上手
 6,635,811 views   3.4 likes/100  123,727 coins  2025-09-17  【何同学】最听劝的一代,但是... iPhone 17系列首
 5,691,330 views   4.2 likes/100   22,149 coins  2025-09-09  【影视飓风】见到了iPhone 17 系列真机
 5,058,280 views   2.8 likes/100   66,764 coins  2025-09-17  iPhone 17系列性能分析:挤爆牙膏!
Enter fullscreen mode Exit fullscreen mode

Views alone hide a lot. The first two videos both have millions of views, but the first got 6.1 likes per 100 views and 874,646 coins, the second 1.9 and 31,885. Coins are their own signal on Bilibili, so they are worth comparing too.

Why the date filter matters

Sorting by views returns the most-watched videos of all time that match your words. When I ran the same search without publishedAfter, the fifth result was a video from 2021, not about the iPhone 17 at all. With the filter, every result is from September 2025 or later.

Know the limits

  • Comments: Bilibili shows logged-out visitors only the top comments of a video (usually 3). The tool never logs in, so you get those top comments plus their full reply threads, up to your limit. That is often dozens of comments per video, but not every comment.
  • Danmaku: Bilibili keeps a limited pool per video, not every one ever sent. The tool reads both public pools and merges them.
  • About 1,000 results per search: that is where Bilibili stops. If you ask for more (up to 5,000) and set no date filter, the tool searches again in date windows to find more.
  • All dates are in UTC.

Cost

$1 per 1,000 rows. A row is one video, comment, danmaku, creator or hot search. Deleted or private videos and requests that stay blocked after all retries are skipped and not charged.

Use it from an AI assistant

The tool also works through Apify's MCP server, so Claude, ChatGPT, Cursor or VS Code can run it for you. Add this server URL to your app: https://mcp.apify.com?tools=serenido/bilibili-scraper

Links

If you research Chinese video and need another field, tell me in the comments.

Top comments (0)