Bilibili Videos & Comments Scraper
Pricing
from $3.00 / 1,000 video results
Bilibili Videos & Comments Scraper
Search public Bilibili videos with independent limits per query, or collect comments and replies from video links.
Pricing
from $3.00 / 1,000 video results
Rating
0.0
(0)
Developer
devcake
Maintained by CommunityActor stats
1
Bookmarked
2
Total users
1
Monthly active users
2 days ago
Last modified
Categories
Share
Search public Bilibili videos or collect comments and replies from video links. The Actor writes structured rows to the Apify dataset and a coverage report to the run's key-value store.
Get started
Enter Search words to find videos, or add Video links or IDs to collect comments. Video links take priority when both are filled, including when the search example is still present. Leave video links empty to search. Blank entries are ignored; if both lists are empty, add search words or video links to start. Invalid video targets are reported instead of starting an unintended search. The form has three sections: Search, Filters, and Comments.
| Scenario | Required input | Dataset rows |
|---|---|---|
| Search | searchQueries | Videos with ordinary search metadata, optionally comments |
| Comments | videoUrls | Comments and optional replies, without standalone video rows |
Search and filters
Enter one independent query per line in Search words. Videos per query defaults to 30 and accepts 30–5000; explicitly lower values are rejected. Three queries at 30 videos each can return up to 90 unique videos. Filters contains search order, length, and inclusive publication dates; Comments ignores these filters.
Videos are deduplicated across queries. A later query continues looking for new videos until its own quota or source limit is reached. Chinese brand-name localization is enabled automatically for supported English brands; translated variants share their original query’s quota.
Comments
Enter one BV ID, older av ID, or https://www.bilibili.com/video/... link per line. Comments collects comments automatically from the first 10 distinct target videos per run by default. Use full Bilibili video URLs or BV/av IDs; shortened b23.tv links and creator/profile URLs are not accepted. It may fetch video metadata internally to identify and contextualize comments, but emits no standalone video rows.
Comments on Search optionally adds comment rows to videos found by Search. This toggle is not required for Comments. Include replies, Anonymize commenters, Comments per video, and Comment order apply whenever comments are collected. Separate reply rows count toward the per-video comment limit. Parent comments may include up to three reply previews even when Include replies is off.
Anonymize commenters clears structured commenter identity fields and preview identities. It does not redact names or other personal information inside comment text, or remove the source-provided location label.
Estimate sentiment adds an estimated score, polarity, and method to collected video and comment rows. It uses SnowNLP for text containing Chinese characters and a small English keyword list otherwise; it is not a general multilingual sentiment model.
Pricing
You pay $0.004 per unique video row ($4 per 1,000) and $0.0015 per unique comment or separate reply row ($1.50 per 1,000) saved to the dataset. Search with comments charges for both row types; Comments-only input charges only for comments and replies.
There is no start fee. Empty results, unavailable videos, validation errors, duplicate rows, inline reply previews, the coverage report, and other legacy output row types do not trigger these charges. Rows already delivered remain chargeable even if a later source request fails. Set a maximum charge for the run to control spending; the Actor stops when it cannot deliver the next result type within that limit, preserves saved rows, and records partial coverage in REPORT. A small remainder may remain unused.
Output
The run’s Output tab links to both the default dataset and the structured coverage report. The dataset provides Overview, Video fields, Comment fields, and Compatible legacy fields views. Its machine-readable schema documents every supported field and record type for API, MCP, and automation clients. The REPORT record contains counts, requests, pagination, warnings, privacy-safe error categories, and coverage limits.
Public scenarios return video and/or comment rows. Search uses ordinary listing metadata without automatic full-details enrichment. Fields unavailable in the listing remain null or empty; missing metrics are not invented.
Video rows include identity, title, description, URL, author, category, available engagement counts, and collection time. Search rows also have searchKeyword and sourceQuery. Comment rows include commentId, text, author fields, engagement, timestamps, videoBvid, video context, and rootRpid/parentRpid for replies.
Example inputs:
{"searchQueries":["人工智能教程","机器学习","Python教程"],"maxVideosPerQuery":30}
{"videoUrls":["BV1xx411c7mD"],"includeReplies":true,"maxComments":20}
Coverage and limits
Bilibili may restrict anonymous searches and comment pages. Unavailable fields remain null or empty. Source restrictions, unexpectedly ended pagination, and failed requested enrichments are recorded in REPORT as partial coverage; a configured limit does not guarantee that many accessible records. A partial or failed report marks the Apify run Failed, even when its dataset contains usable rows; inspect both the dataset and REPORT. Reaching a requested quota alone does not mark a run as failed.
Search uses Videos per query independently for each query. Comments processes up to 10 target videos per run by default. Comments per video includes replies, and comment rows do not consume video quotas. Pagination also has internal page bounds.
Transient network/5xx failures and rate limits (HTTP429/API−509) have at most two retries by default, with exponential backoff and up to 0.5s jitter. Retry-After is honored when it fits the cumulative 30-second retry-wait budget; otherwise the request stops without retrying early. Verification/authentication failures are not blindly retried. The Actor does not solve CAPTCHA or verification challenges. REPORT.retries provides safe endpoint/reason/delay diagnostics.
Search filters affect video discovery only. They do not filter comments by date or length. Most liked in results sorts the comments actually collected; it does not guarantee the most-liked comments across the entire video.
Existing API integrations
The current form selects Search or Comments automatically. An explicit legacy mode in API input or saved JSON overrides that selection. Remove mode from an old saved input to use the current automatic behavior.
Creator collection, direct video details, subtitles, rankings, and other historical modes are not offered in the form. Their runtime implementations remain for existing integrations, with no guarantee of complete creator listings or access to restricted data. See the legacy API compatibility reference for retained settings and limits.
Local development
python -m venv .venv.venv/bin/pip install -r requirements.txt pytest ruff.venv/bin/python -m pytest tests -q.venv/bin/ruff check bilibili_scraper testsapify validate-schema
The Dockerfile uses Python 3.12. apify push deploys the code and builds it on Apify. Cloud runs use an Apify China residential proxy by default, or a privately configured BILIBILI_PROXY_URL environment variable. Proxy credentials belong in private runtime configuration, never in Actor input or source control. Local command-line runs also accept --proxy-file /private/path/proxy.txt; see python -m bilibili_scraper --help.