{
  "openapi": "3.0.1",
  "info": {
    "title": "Bilibili Comments & Danmaku Scraper API, No Login – B站 哔哩哔哩",
    "description": "Bilibili scraper API, no login: video comments, replies, danmaku (弹幕), search videos, video details, user profiles, creator videos, followings, popular & hot videos, weekly must-watch, precious, ranking, hot search (热搜), live rooms from B站/哔哩哔哩 as JSON. Lean AI-agent output, dry run. $0.005/video.",
    "version": "2.1",
    "x-build-id": "2b3BXeb1ZiBAj7dkO"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/deadc0dex~bilibili-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-deadc0dex-bilibili-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/deadc0dex~bilibili-scraper/runs": {
      "post": {
        "operationId": "runs-sync-deadc0dex-bilibili-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/deadc0dex~bilibili-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-deadc0dex-bilibili-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "operation": {
            "title": "Operation (optional, auto-detected)",
            "enum": [
              "auto",
              "search",
              "keywordComments",
              "videoDetails",
              "comments",
              "replies",
              "danmaku",
              "related",
              "userProfile",
              "userVideos",
              "searchUsers",
              "popular",
              "weekly",
              "precious",
              "ranking",
              "hotSearch",
              "followings",
              "liveRoom",
              "capabilities"
            ],
            "type": "string",
            "description": "auto (default) picks from inputs: users→userProfile, urls→videoDetails, keywords→search, nothing→popular. search, searchUsers: keywords. keywordComments (alias keyword_comments): research workflow keyword→top maxVideos videos→comments+replies→free insights row. videoDetails, comments, danmaku, related: urls. replies: ids \"BV…:commentId\". userProfile, userVideos, followings, liveRoom: users. No input: popular, weekly, precious, ranking, hotSearch (热搜). capabilities = free manifest.",
            "default": "auto"
          },
          "keywords": {
            "title": "Keywords (search videos, search users)",
            "type": "array",
            "description": "Search terms, one per item, Chinese or English (原神, 黑神话悟空, BYD, iPhone 16). Used by search (videos) and searchUsers (creators). English brand/person/topic names are also searched in Chinese (BYD→比亚迪) unless expandQuery is false; rows show queryUsed. A video/creator link put here is routed to the right operation.",
            "items": {
              "type": "string"
            }
          },
          "urls": {
            "title": "Video URLs or IDs (video details, comments, danmaku, related videos)",
            "type": "array",
            "description": "Videos, one per item: https://www.bilibili.com/video/BV17x411w7KC (also m.bilibili.com, ?p=2 for part 2), bare BV ids, av ids (av170001), b23.tv links. Used by videoDetails (default when filled), comments, danmaku and related. Bad ids return an error row (not billed).",
            "items": {
              "type": "string"
            }
          },
          "users": {
            "title": "Creators (UP主): user profile, creator videos, followings, live rooms",
            "type": "array",
            "description": "Creators, one per item: numeric mid (946974), \"mid:946974\", https://space.bilibili.com/946974, or an exact creator name (影视飓风, resolved via search). Live rooms: https://live.bilibili.com/173551. Used by userProfile (default when filled), userVideos, followings and liveRoom.",
            "items": {
              "type": "string"
            }
          },
          "ids": {
            "title": "Other ids (any form)",
            "type": "array",
            "description": "Any mix of ids, auto-routed by shape: \"BV17x411w7KC:1353715029\" (video:commentId) → replies; BV/av ids → videos; \"mid:946974\" or space links → creators; live links → liveRoom. Bare numbers are treated as av ids; prefix creators with mid:.",
            "items": {
              "type": "string"
            }
          },
          "maxItemsPerInput": {
            "title": "Max rows per input",
            "type": "integer",
            "description": "Rows per keyword / URL / creator (per feed for popular, weekly, ranking, hotSearch). Default by operation: 10 (videos, creators), 20 (comments, replies), 100 (danmaku), 50 (hotSearch). Range 1-5000; out-of-range values are clamped."
          },
          "maxItems": {
            "title": "Max rows per run (total)",
            "type": "integer",
            "description": "Total billable rows for the whole run, all kinds together (videos + comments + danmaku + …). Default 1000, max 20000. Legacy: if maxItemsPerInput is not set, maxItems is used per input as in v0.x."
          },
          "maxCostUsd": {
            "title": "Max cost (USD)",
            "type": "number",
            "description": "Stop before the run's charges would exceed this amount (e.g. 0.05). Rows are priced per kind: video $0.005, comment $0.001, danmaku $0.0001, creator/live room $0.003, hot search term $0.001. Error, summary, plan and capabilities rows are free. The platform \"max cost per run\" is also respected."
          },
          "include": {
            "title": "Include (optional enrichments)",
            "type": "array",
            "description": "tags: video tags (always on unless includeTags=false). details: full stats for search/list rows. owner: ownerFollowers. parts: parts list. topComments: 3 hot comments nested (free). comments / danmaku: extra rows after each video (commentsPerItem / danmakuPerItem, billed). replies: reply rows under comments. author: commenter name/mid/level/IP region (off for privacy). liveRoom: live status on creator rows. insights: free heuristic insights row (see insights).",
            "items": {
              "type": "string",
              "enum": [
                "tags",
                "details",
                "owner",
                "parts",
                "topComments",
                "comments",
                "replies",
                "danmaku",
                "author",
                "liveRoom",
                "insights"
              ]
            }
          },
          "fields": {
            "title": "Fields to return (projection)",
            "type": "array",
            "description": "Return only these fields (type is always kept), e.g. [\"title\",\"url\",\"views\",\"likes\",\"publishedAt\"]. Empty = all fields of each row kind. Video: bvid, title, description, ownerName, ownerMid, views, likes, coins, favorites, shares, danmaku, replies, tags, durationSeconds, publishedAt. Comment: text, likes, replyCount, publishedAt, videoBvid. Fewer fields = fewer requests: e.g. without tags no tag request per video. Full list: operation capabilities.",
            "items": {
              "type": "string"
            }
          },
          "outputMode": {
            "title": "Output mode",
            "enum": [
              "compact",
              "lean",
              "full"
            ],
            "type": "string",
            "description": "compact (default): every field of the row kind, null when unknown, descriptions cut to 300 chars. lean: token-efficient for LLM agents: type + id + a few key fields, nulls/empty values omitted, operation/input/fetchedAt stated once in the summary row, text cut to maxTextChars (default 300), dates YYYY-MM-DDTHH:MMZ UTC. fields still overrides. full: complete text plus the raw Bilibili API record.",
            "default": "compact"
          },
          "maxVideos": {
            "title": "Videos per keyword (keywordComments)",
            "type": "integer",
            "description": "keywordComments only: how many top videos per keyword get their comments read (after sortBy, dateFrom/dateTo and minViews filters). Default 5, max 50. Other operations use maxItemsPerInput."
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "relevance",
              "views",
              "newest",
              "danmaku",
              "favorites",
              "comments",
              "hot"
            ],
            "type": "string",
            "description": "search + keywordComments (video order): relevance (default), views (most played), newest, danmaku (most bullet comments), favorites, comments. comments: hot (default) or newest (or use commentSort). userVideos: newest (default) or views. Ignored by feeds."
          },
          "dateFrom": {
            "title": "Published from",
            "type": "string",
            "description": "Keep only videos / comments / danmaku published on or after this date: YYYY-MM-DD (Beijing time), ISO time, unix seconds, or relative \"7d\", \"24h\", \"2w\". Search passes it to Bilibili; other operations filter before billing (filtered rows are free)."
          },
          "dateTo": {
            "title": "Published to",
            "type": "string",
            "description": "Keep only items published on or before this date. Same formats as dateFrom."
          },
          "minViews": {
            "title": "Min views",
            "type": "integer",
            "description": "Videos only: drop videos with fewer plays (filtered before billing)."
          },
          "minLikes": {
            "title": "Min likes",
            "type": "integer",
            "description": "Videos and comments: drop rows with fewer likes (filtered before billing)."
          },
          "matchTerms": {
            "title": "Match terms (keep matching comments)",
            "type": "array",
            "description": "Optional: keep only top-level comments and danmaku whose text contains any of these terms (case-insensitive, e.g. [\"续航\",\"battery\"]). Replies under a kept comment are kept as context. Filters AFTER fetching: fewer billed rows, not fewer requests; per video at most 10x the wanted comments (max 3000) are scanned.",
            "items": {
              "type": "string"
            }
          },
          "dryRun": {
            "title": "Dry run (free plan)",
            "type": "boolean",
            "description": "true: fetch nothing and return one free plan row: operation per input, Chinese query used, estimated rows and estimated cost. Use it to check an input and its price before running.",
            "default": false
          },
          "commentsPerItem": {
            "title": "Comments per video",
            "type": "integer",
            "description": "Comment rows per video for keywordComments and include [\"comments\"] (aliases maxCommentsPerItem, maxCommentsPerVideo). Default 10, max 500."
          },
          "replyDepth": {
            "title": "Reply depth",
            "type": "integer",
            "description": "0 = top-level comments only, 1 = also replies under each top-level comment (repliesPerComment each). Bilibili threads have 2 levels, so 1 is the maximum. keywordComments default 1; elsewhere include [\"replies\"] does the same."
          },
          "repliesPerComment": {
            "title": "Replies per comment (include replies)",
            "type": "integer",
            "description": "Reply rows under each top-level comment that has replies (with replyDepth 1 or include [\"replies\"]). Default 5 (keywordComments: 2), max 200. Billed as comment rows."
          },
          "commentSort": {
            "title": "Comment order",
            "enum": [
              "hot",
              "newest"
            ],
            "type": "string",
            "description": "Order of comment rows (comments, keywordComments, include comments): hot = most liked/replied first (default), newest = newest first. Empty: comments uses newest when sortBy is newest, otherwise hot."
          },
          "insights": {
            "title": "Insights row (free, heuristic)",
            "type": "boolean",
            "description": "Adds free insights row(s): top terms (CJK bigrams + words), emotes, matchTerms counts, lexicon sentiment labelled heuristic (no LLM), most-liked comments, top videos, danmaku peak minute and a per-video danmaku profile (per-minute timeline, peak minute, pool size, unique senders with include author); comment rows get sentimentHeuristic. Default on for keywordComments, off elsewhere."
          },
          "trackMetrics": {
            "title": "Snapshot mode (track metric changes)",
            "type": "boolean",
            "description": "With deltaKey: video and creator rows always come back with viewsDelta, likesDelta, commentsDelta, danmakuDelta, favoritesDelta, coinsDelta, sharesDelta, engagementRateDelta (creators: followersDelta…) and snapshotAt vs the previous run with the same key. Only compact numbers are stored. Default off."
          },
          "deltaKey": {
            "title": "Delta key (only new rows)",
            "type": "string",
            "description": "Monitoring mode: give a name (e.g. byd-daily) and every later run with the same name returns only rows (videos, comments, danmaku, creators, trends) it has not returned before. Already-seen rows are skipped and free. State is kept in the named key-value store bilibili-scraper-delta of your account. Empty = normal run. With trackMetrics, video/creator rows return with deltas instead of being skipped."
          },
          "expandQuery": {
            "title": "Expand English queries to Chinese",
            "type": "boolean",
            "description": "On (default): Latin-script keywords are matched against a curated dictionary (~900 brands, companies, people, games, anime, topics) and searched in Chinese first, e.g. BYD→比亚迪, Black Myth Wukong→黑神话悟空; the original keyword fills any shortfall. Deterministic, no machine translation. Rows show queryUsed.",
            "default": true
          },
          "leanFormat": {
            "title": "Lean format",
            "enum": [
              "rows",
              "table"
            ],
            "type": "string",
            "description": "Only with outputMode lean. rows (default): lean JSON rows. table: also one TSV text block per row kind (header line once, tab-separated) in the summary row (leanTable, if under 20 KB) and in key-value record LEAN_TABLE: the most token-efficient form for an LLM. Rows are still returned and billed the same."
          },
          "danmakuPerItem": {
            "title": "Danmaku per video (include danmaku)",
            "type": "integer",
            "description": "With include [\"danmaku\"]: danmaku rows per video, spread evenly over the video timeline. Default 100, max 5000."
          },
          "durationFilter": {
            "title": "Video length (search)",
            "enum": [
              "any",
              "short",
              "medium",
              "long",
              "verylong"
            ],
            "type": "string",
            "description": "search only: any (default), short (<10 min), medium (10-30 min), long (30-60 min), verylong (>60 min).",
            "default": "any"
          },
          "rankingCategory": {
            "title": "Ranking category",
            "enum": [
              "0",
              "1001",
              "1002",
              "1003",
              "1004",
              "1005",
              "1007",
              "1008",
              "1010",
              "1012",
              "1013",
              "1014",
              "1018",
              "1020",
              "1024",
              "all",
              "film",
              "entertainment",
              "music",
              "dance",
              "animation",
              "kichiku",
              "gaming",
              "knowledge",
              "tech",
              "cars",
              "fashion",
              "sports",
              "food",
              "animals"
            ],
            "type": "string",
            "description": "ranking only. 0 or all (default), 1001 film (Film & TV), 1002 entertainment, 1003 music, 1004 dance, 1005 animation, 1007 kichiku (remix), 1008 gaming, 1010 knowledge, 1012 tech, 1013 cars, 1014 fashion, 1018 sports, 1020 food, 1024 animals. Numeric id or English name.",
            "default": "0"
          },
          "weeklyIssue": {
            "title": "Weekly issue number",
            "type": "integer",
            "description": "weekly only. Issue number of 每周必看; 0 = latest issue.",
            "default": 0
          },
          "dedupe": {
            "title": "Dedupe",
            "type": "boolean",
            "description": "true (default): a video/comment/creator found by several inputs is returned (and billed) once.",
            "default": true
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Requests go direct first (fastest) and switch to Apify Proxy automatically when Bilibili blocks them. A proxy group (e.g. RESIDENTIAL, country HK for region-locked videos) or your own proxy URLs are used from the first request.",
            "default": {
              "useApifyProxy": true
            }
          },
          "maxRequestRetries": {
            "title": "Max retries per request",
            "type": "integer",
            "description": "Retries with a fresh session/IP on rate-limit or risk-control (-352/412) responses. 0-10.",
            "default": 4
          },
          "requestDelayMs": {
            "title": "Delay between requests (ms)",
            "type": "integer",
            "description": "Minimum delay between API requests in ms (0-10000). Default 0: up to 8 parallel requests, and the Actor slows itself down to 250 ms automatically after the first rate-limit/risk-control answer.",
            "default": 0
          },
          "maxTextChars": {
            "title": "Max text characters",
            "type": "integer",
            "description": "Cut title, description, comment/danmaku text and creator sign to this many characters (cut text ends with … and lean rows get truncated: true). Default: 300 in lean; compact cuts only descriptions at 300; full is unlimited. Range 20–100000."
          },
          "allParts": {
            "title": "Danmaku: all parts",
            "type": "boolean",
            "description": "danmaku only. Read every part (P1, P2, …) of multi-part videos instead of the first one (or the ?p= part in the link). maxItemsPerInput is split evenly over the parts.",
            "default": false
          },
          "danmakuSource": {
            "title": "Danmaku source",
            "enum": [
              "xml",
              "segments"
            ],
            "type": "string",
            "description": "xml (default): the part's newest danmaku pool, 1 request (up to a few thousand rows). segments: the XML pool plus every 6-minute protobuf segment of the part, deduplicated: a fuller track for busy videos (1 extra request per 6 minutes of video)."
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}