Bilibili Comments avatar
Bilibili Comments

Pricing

$0.01 / 1,000 results

Go to Store
Bilibili Comments

Bilibili Comments

Developed by

Bi Shi

Bi Shi

Maintained by Community

Effortlessly extract comments and replies from any Bilibili video.

0.0 (0)

Pricing

$0.01 / 1,000 results

0

Total users

2

Monthly users

2

Runs succeeded

>99%

Last modified

2 days ago

Bilibili Comment Scraper

This Apify Actor allows you to scrape comments and replies from any Bilibili video. It's designed to be simple to use, handling the complexities of the Bilibili API for you. You can easily paginate through thousands of comments and replies across multiple Actor runs.

Features

  • Two scraping modes: Scrape root-level comments or replies to a specific comment.
  • Flexible video identifier: Use a video's URL, BVID, or AVID.
  • Powerful pagination: Seamlessly continue scraping from where you left off in a previous run.
  • Control scrape direction: Fetch comments from newest to oldest or oldest to newest.
  • Simple and robust: Just provide the video and let the Actor handle the rest.

How to Use

The Actor operates in two modes: Comment Mode (default) and Reply Mode.

1. Scraping Root Comments

To get the main comments for a video, simply provide the video identifier.

  1. Set the video input field to the URL, BVID, or AVID of the Bilibili video.
  2. Run the Actor.
  3. The results will appear in the Actor's dataset. Each item is a comment object from Bilibili, with an added cursor field for pagination.
  4. To get the next batch of comments, find the last comment in your dataset. Copy the value of cursor.next_offset from it.
  5. Run the Actor again with the same video input, but this time paste the copied value into the offset input field.
  6. Repeat until cursor.is_end is true in the last comment of a run, which means all comments have been scraped.

2. Scraping Replies

To get replies for a specific comment, you first need its ID.

  1. Run the Actor in Comment Mode to get the root comments.
  2. In the dataset, find the comment for which you want to scrape replies. Note its rpid value.
  3. Run the Actor again. This time, in addition to the video input, set the root_comment_id field to the rpid you just found. This will activate Reply Mode.
  4. Pagination for replies works just like for root comments. Use the cursor.next_offset from the last reply in a dataset as the offset for the next run.

Input

The Actor's behavior is controlled by the following input fields:

FieldTypeRequiredDescription
videoStringYesIdentifier for the Bilibili video. Can be a full URL (e.g., https://www.bilibili.com/video/BV1...), a BVID (e.g., BV1Db411L7F5), or an AVID (e.g., av80682285).
root_comment_idIntegerNoThe ID (rpid) of a root comment. Providing this switches the Actor to Reply Mode to scrape its replies.
limitIntegerNoMaximum number of comments to return. Defaults to 20, maximum 1000.
offsetIntegerNoThe starting point for scraping. For subsequent runs, use the cursor.next_offset value from the last item of the previous run's dataset.
directionIntegerNo(Comment Mode only) The order in which to scrape comments. 1 for oldest to newest, 2 for newest to oldest. Defaults to 2.

Example Input

Scraping root comments (first run):

{
"video": "BV1Db411L7F5",
"limit": 100
}

Scraping replies for comment with ID 6013353598:

{
"video": "BV1Db411L7F5",
"root_comment_id": 6013353598,
"limit": 60
}

Paginating (continuing a previous run):

{
"video": "BV1Db411L7F5",
"limit": 100,
"offset": 20
}

Output

The Actor stores its results in the default dataset. Each item in the dataset is a JSON object representing a single comment or reply, with an added cursor object containing metadata about the scraping process.

Example Output Item

{
"rpid": 6013353598,
"oid": 80682285,
"type": 1,
"mid": 17924040,
"root": 0,
"parent": 0,
"like": 1234,
"member": {
"mid": "17924040",
"uname": "some_user",
"sex": "保密"
},
"content": {
"message": "This is a comment."
},
"replies": null,
"cursor": {
"batch_number": 0,
"is_begin": true,
"is_end": false,
"next_offset": 20,
"all_count": 5000
}
}

Note: The fields in the main object (like rpid, member, content, etc.) come directly from the Bilibili API and are subject to change.

The cursor Object

This object is attached to every comment and provides context for pagination.

FieldTypeDescription
next_offsetIntegerThe most important field. Use this as the offset in your next run to get the next page of results.
is_endBooleanIf true, you have reached the last page of comments/replies in the current direction.
max_offsetInteger(Comment Mode only) Total number of root comments for the video. Note that offset numbers are not always consecutive.
total_countInteger(Reply Mode only) Total number of replies for the comment.
is_beginBooleanIf true, this is the first page of results.
batch_numberIntegerThe batch number of the current request (starts at 0).