Bilibili API: video keyword search and comments
Based on the 2026-11-21 specification
Quick answer
The Bilibili API has two asynchronous tasks. POST /bilibili/search/task searches Bilibili videos by keyword and publish date range (default the last 7 days) and collects up to 50 result pages of 20 videos, about 1,000 videos per query. POST /bilibili/pushs/task collects the comments of one video, with the replies under them. Poll each task with GET; once it is DONE the same response returns the records, newest first. Each video has its URL, title, description, uploader, publish time, view, like and comment counts and cover image. Comment collection is limited: a task collects at most the 3 most popular top-level comments of a video and the first 20 replies under each. Data is collected by web crawlers from content publicly published on Bilibili.
API pages by capability
Data you get
Fields follow the 2026-11-21 specification. Until a task is DONE the poll returns only the task object; once DONE the same response carries task, total_count, data, page and pageSize. Records can carry more fields than listed here; descriptive fields such as meta_keywords, location and icon_url may be empty.
| Data | Fields | Endpoint |
|---|---|---|
| Videos from keyword search | id, url, title, content, tm, datetime, tm_crawler, tm_update, author, author_id, type, ctype, source, sentiment, view_count, like_count, comment_count, metadata_img | GET /bilibili/search/task/{task_id} |
| Search task status and counters | task: id, keyword, status, start_date, end_date, max_pages, created_at, total, completed, pages_crawled, partial, timed_out, failed_pages, failed_articles, failed_ranges, num_results | GET /bilibili/search/task/{task_id} |
| Video comments and replies | id, post_id, author_id, author, push_type, region, content, tm, tm_crawler, sentiment | GET /bilibili/pushs/task/{task_id} |
| Comment task status and counters | task: id, post_url, status, crawl_second_layer, created_at, total, completed, pages_crawled, reported_total, partial, timed_out, failed_pages, failed_batches, bvid | GET /bilibili/pushs/task/{task_id} |
Endpoints
Base URL: https://api.infominer.io/api/v2. Send your API key in the auth-header request header. Parameters marked * are required.
| Method | Path | What it does | Main parameters |
|---|---|---|---|
| POST | /bilibili/search/task |
Create a video keyword search task with an optional date range and page limit. | keyword* end_date max_pages rerun start_date |
| GET | /bilibili/search/task/{task_id} |
Poll the search task; once DONE it returns the videos and total_count, up to 100 per page. | task_id* page pageSize |
| POST | /bilibili/pushs/task |
Create a comment task from a /video/BV... URL, optionally with replies. | post_url* crawl_second_layer max_pages rerun |
| GET | /bilibili/pushs/task/{task_id} |
Poll the comment task; once DONE it returns the comments, up to 1000 per page. | task_id* page pageSize |
How to get the data
- POST /bilibili/search/task with keyword (1 to 100 characters) and optional start_date and end_date (YYYY-MM-DD, UTC+8, inclusive; default the last 7 days) and max_pages (0 to 50; 0 or omitted means 50, 20 videos per page). The response is the task with its id and status INIT.
- Poll GET /bilibili/search/task/{task_id}. Poll every 3 to 5 seconds and set an overall deadline. Statuses are INIT, RUNNING, DONE, PARTIAL, TIMED_OUT (no progress for more than 600 seconds) and FAILED. Only a DONE response carries data; the others return the flat task object, so read the status as task.status or, before DONE, status. A task fully succeeded when status is DONE and partial and timed_out are both false.
- Once DONE, read the videos from data with page and pageSize (up to 100 per page). num_results is the result count Bilibili reports, an estimate that can exceed what can be fetched.
- For a video whose comments you need, POST /bilibili/pushs/task with its /video/BV... URL. crawl_second_layer (default true) adds the replies under each comment. Poll GET /bilibili/pushs/task/{task_id} and read the comments with pageSize up to 1000; reported_total is the comment count Bilibili shows.
curl examples
Create a keyword search task
curl -X POST https://api.infominer.io/api/v2/bilibili/search/task \
-H "auth-header: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"keyword": "露营装备", "start_date": "2026-06-01", "end_date": "2026-06-07", "max_pages": 3}'
Poll the task by ID
curl "https://api.infominer.io/api/v2/bilibili/search/task/$TASK_ID?page=1&pageSize=100" \
-H "auth-header: YOUR_API_KEY"
Create a comment task from a video URL
curl -X POST https://api.infominer.io/api/v2/bilibili/pushs/task \
-H "auth-header: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"post_url": "https://www.bilibili.com/video/BV1000000001/", "crawl_second_layer": true}'
Sample JSON
Illustrative data written by hand: accounts are sample_user_n and IDs are obviously fake. These are not real posts.
Task creation response (Illustrative data)
{
"id": "00000000-0000-4000-8000-000000000001",
"keyword": "露营装备",
"status": "INIT",
"start_date": "2026-06-01",
"end_date": "2026-06-07",
"max_pages": 3,
"created_at": 1780880400,
"total": 0,
"completed": 0,
"pages_crawled": 0,
"num_results": null,
"timed_out": false,
"partial": false,
"failed_pages": 0,
"failed_articles": 0,
"failed_ranges": 0
}
Poll response once the task is DONE (Illustrative data)
{
"task": {
"id": "00000000-0000-4000-8000-000000000001",
"keyword": "露营装备",
"status": "DONE",
"start_date": "2026-06-01",
"end_date": "2026-06-07",
"max_pages": 3,
"created_at": 1780880400,
"total": 2,
"completed": 2,
"pages_crawled": 1,
"num_results": 2,
"timed_out": false,
"partial": false,
"failed_pages": 0,
"failed_articles": 0,
"failed_ranges": 0
},
"total_count": 2,
"data": [
{
"id": "00000000-0000-4000-8000-000000000001",
"url": "https://www.bilibili.com/video/BV1000000001/",
"title": "新手露营装备清单,第一次出门带这些就够了",
"content": "新手露营装备清单,第一次出门带这些就够了",
"tm": 1780666200,
"datetime": "2026-06-05 21:30:00",
"tm_crawler": 1780880405,
"tm_update": 1780880405,
"author": "sample_user_1",
"author_id": "0000000001",
"type": [
"sample_user_1"
],
"ctype": [
"sample_user_1"
],
"source": "bilibili",
"sentiment": "Positive",
"view_count": 5230,
"like_count": 318,
"comment_count": 46,
"metadata_img": [
"https://i0.hdslb.com/bfs/archive/sample_cover_1.jpg"
]
},
{
"id": "00000000-0000-4000-8000-000000000002",
"url": "https://www.bilibili.com/video/BV1000000002/",
"title": "三款轻量帐篷实测:下雨天的表现差别很大",
"content": "露营装备里最难选的是帐篷,同一个周末在山上搭了三款,记录了防水和通风的情况",
"tm": 1780452000,
"datetime": "2026-06-03 10:00:00",
"tm_crawler": 1780880409,
"tm_update": 1780880409,
"author": "sample_user_2",
"author_id": "0000000002",
"type": [
"sample_user_2"
],
"ctype": [
"sample_user_2"
],
"source": "bilibili",
"sentiment": "Neutral",
"view_count": 1870,
"like_count": 95,
"comment_count": 21,
"metadata_img": [
"https://i0.hdslb.com/bfs/archive/sample_cover_2.jpg"
]
}
],
"page": 1,
"pageSize": 100
}
How posts and comments link
A comment task is created from the video URL. Every comment record has post_id, the document ID of the video, which equals the id of the same video in search results. push_type is comment for a top-level comment and reply for a reply under a comment. The comment task object carries bvid, the video's BV id. data holds every collected comment of the video, including comments collected by earlier tasks, so total_count can differ from task.completed.
History and limits
- One search query yields at most 50 pages, about 1,000 videos. For popular keywords narrow the date range or split it into several tasks.
- A comment task collects at most the video's 3 most popular top-level comments and the first 20 replies under each, so completed far below reported_total is expected and does not mean the task failed.
- region (IP location) is always empty for Bilibili comments.
- share_count, reply_count and dislike_count are always 0 for videos. is_video is currently false for every record, although every record is a video.
- post_url must be a /video/BV... URL on bilibili.com; av URLs and b23.tv short links are not accepted, so expand them first.
- data is a keyword match over everything collected for the date range, including results of earlier tasks, so total_count can exceed task.completed. task.completed is what this task collected. Like, comment and view counts are as of collection. The collected counts are refreshed later, at no fixed time.
- Creating many tasks in a short time can make tasks queue, or end PARTIAL or FAILED when Bilibili refuses requests; during a search Bilibili sometimes withholds later pages for a while, and the task then ends PARTIAL. How far back search can go is confirmed per project scope.
Delivery format
JSON. Search and comment tasks return their records in the poll response once DONE, paginated with page and pageSize (search up to 100 per page, comments up to 1000). Batch files or other delivery are confirmed per project scope.
Request a trial
In the form below, mention Bilibili and tell us the keywords or videos you want to follow, whether you need comments, and the expected volume. We will confirm the scope and arrange a trial and an API key.
Fill in the form to request a trial. We confirm the scope and reply with trial and integration arrangements.
Fill in the request formFAQ
- Can I get every comment of a Bilibili video?
- No. A comment task collects at most the video's 3 most popular top-level comments and the first 20 replies under each. Compare task.completed with reported_total to see the share collected.
- How many videos does one Bilibili search return?
- At most 50 pages of 20 videos, about 1,000 videos per query. For more, split the date range into several tasks.
- Can I use a b23.tv short link or an av URL?
- No. Expand it to a https://www.bilibili.com/video/BV.../ URL first; tracking parameters on that URL are allowed.
- What do the HTTP error codes mean?
- HTTP 400 means a malformed request (for example a missing keyword or a start_date after end_date), 401 a missing or invalid key, 403 a key without access to this platform, 404 an unknown task ID, and 422 a request the crawler service rejected, such as a URL from the wrong site or max_pages out of range; no task is created. Retry 500 and 502 with backoff, and 503 after Retry-After.
- Is this a Bilibili scraper API? How is the data collected?
- Yes. LargitData collects content publicly published on Bilibili with web crawlers and returns it as JSON through the API, so you do not run scrapers yourself. LargitData is not affiliated with Bilibili and this is not Bilibili's own API. Whether this suits your use depends on the purpose and jurisdiction and is for your legal team to assess; we can provide a description of sources and collection methods.