DEV Community

CleanScrape
CleanScrape

Posted on AI-assisted

What Chinese viewers say about coffee, second by second

If you want to know what Chinese viewers watch and say about a topic, Bilibili is one of the best places to look. It is one of China's biggest video sites, and its viewers comment in two ways: ordinary comments under the video, and danmaku, the comments that fly across the video at the moment they were written.

I built CleanScrape's Bilibili Scraper to get both into a spreadsheet without a Bilibili account. I'm the developer, so this is a walkthrough of my own tool, not an independent review. Every number in it was checked against my runs.

One search term, 100 videos

For the example I searched for 咖啡 (coffee) and turned on top comments and danmaku. You need an Apify account to run the Actor, but no Bilibili login or cookies. The same input as JSON:

{
  "searchQueries": ["咖啡"],
  "maxVideosPerQuery": 100,
  "includeComments": true,
  "includeDanmaku": true,
  "maxDanmakuPerVideo": 500
}
Enter fullscreen mode Exit fullscreen mode

The run took 81 seconds and saved 100 videos with views, likes, coins, favorites, shares and tags, plus 1,357 top comments and replies and 12,055 danmaku. Videos, comments, danmaku and creators each land in their own table, so an export holds one kind of row.

Why it doesn't get blocked

Bilibili limits how fast one visitor can read each kind of data, and it blocks an IP for minutes to an hour when that limit is crossed. I measured those limits field by field before building the Actor. It spreads the work over several proxy connections at once (nine in this run), keeps each one under the measured pace, and moves work elsewhere when Bilibili refuses a request. In this run, 5 of 604 requests were refused, all for danmaku, and every one was retried on another connection. No video is missing its danmaku.

What the danmaku show

The most-watched video in the results, about drinking six cups of coffee a day, has 5,108,457 views and 63,604 coins. A second run collected the 1,800 danmaku Bilibili's player loads for it (10,343 were sent in total), each with its time in the video.

Count them in 20-second steps and the busiest stretch after the opening is 0:40 to 1:00, with 136 danmaku. 21 of those are about bitterness, and the running joke is that life is more bitter than coffee:

  • 再苦能有生活苦: "Can it be more bitter than life?"
  • 咖啡没有我的命苦: "Coffee isn't as bitter as my life"
  • 因为生活比咖啡还苦: "Because life is even more bitter than coffee"

That kind of moment-by-moment reaction is hard to get any other way. Comments tell you what people thought after watching; danmaku tell you what they felt at a given second.

Top comments

Without login Bilibili shows the top comments of a video (usually 3) and the first 20 replies under each, so this is a sample, not every comment. On the coffee video, the pinned top comment asks whether anyone has managed to quit coffee. It has 5,941 likes and 714 replies.

Export and cost

Open Storage > Dataset, choose Default (videos), Comments, Danmaku or Creators, and download CSV, Excel or JSON. From the API, the run object lists the four datasets under storageIds.datasets.

At base prices a video costs $1.49 per 1,000, a comment $0.49 per 1,000 and a danmaku $0.10 per 1,000, with no start fee and platform usage included. 100 videos with tags cost about $0.15. There are also ready-made examples for a keyword, one video's danmaku and a creator's profile and videos.

Besides search terms, you can paste video links, BV ids, creator links or UIDs, or the whole text the Bilibili app copies with Share > Copy link.

What it can't do without login: every comment of a video, a creator's full upload history (it uses their public collections and series), subtitles, and bilibili.tv, the international site.

Questions or a reproducible problem: use the Actor's Issues tab or email contact.cleanscrape@gmail.com. CleanScrape is independent of Bilibili and Apify.

Top comments (0)