{
  "openapi": "3.0.1",
  "info": {
    "title": "Bilibili Scraper - Videos, Creators, Comments, Danmaku",
    "description": "[💰$0.02/1K] Scrape Bilibili video search, creator profiles and uploads, comments and danmaku in seven modes. Every row keeps view, like, favourite and coin counts with tags, duration, owner, category and a stable resultId for dedupe. Public web API, no proxy, no cookies, no login.",
    "version": "0.9",
    "x-build-id": "FGl6jZkrIEkSEdHPP"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ai-lead-gen-tools~bilibili-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ai-lead-gen-tools-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/ai-lead-gen-tools~bilibili-scraper/runs": {
      "post": {
        "operationId": "runs-sync-ai-lead-gen-tools-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/ai-lead-gen-tools~bilibili-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-ai-lead-gen-tools-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",
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "search",
              "video",
              "creator",
              "popular",
              "ranking",
              "comments",
              "danmaku"
            ],
            "type": "string",
            "description": "What to scrape. `search` reads keyword results, `video` reads the video URLs and BV ids you list, `creator` reads a creator profile and the whole upload list, `popular` reads the popular feed, `ranking` reads the ranking board, `comments` reads root comments for the videos you list, `danmaku` reads danmaku for the videos you list."
          },
          "queries": {
            "title": "Search keywords",
            "type": "array",
            "description": "Keywords to search, one target per keyword. Bilibili accepts the keyword as typed, so Chinese terms give the best recall.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "videoUrls": {
            "title": "Video URLs or BV ids",
            "type": "array",
            "description": "Full video links or bare BV ids, one target per video. An `av` id or a `/video/` URL is reduced to its BV id before the detail request.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "creatorMids": {
            "title": "Creator mids",
            "type": "array",
            "description": "Numeric creator ids, one target per creator. The upload list is read at 50 videos per request and followed until the creator's catalogue ends; 683 of 683 on the reference channel.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "searchOrders": {
            "title": "Sort orders to union",
            "type": "array",
            "description": "Which of the six search orders to walk and merge. One order alone plateaus at 288 distinct videos; all six together give 1144 to 1199 for one keyword. Each order costs its own requests, so the default walks `totalrank` only and the full union is opt-in.",
            "items": {
              "type": "string"
            },
            "default": [
              "totalrank"
            ]
          },
          "maxItems": {
            "title": "Max rows",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Hard cap on dataset rows for the whole run, shared across every target. The run stops requesting once the cap is reached.",
            "default": 200
          },
          "maxPagesPerOrder": {
            "title": "Max pages per sort order",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Page cap per keyword per sort order, counted in search requests. A target also stops earlier once a page adds no new video, which is what a single order does after roughly fifteen pages.",
            "default": 5
          },
          "rowsPerPage": {
            "title": "Videos per search request",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "Page size requested from search. Bilibili serves 20 per page reliably; page 1 occasionally comes back empty, so the actor retries it once before giving up.",
            "default": 20
          },
          "maxCreatorPages": {
            "title": "Max upload pages per creator",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Page cap for the creator upload list, 50 videos per page. The default follows the whole catalogue; lower it to sample a large channel.",
            "default": 40
          },
          "includeReplies": {
            "title": "Fetch comment replies",
            "type": "boolean",
            "description": "Fetch the replies under each root comment. Bilibili returns at most twenty replies per root no matter which variant is asked, so this adds rows but cannot reach the full thread.",
            "default": false
          },
          "commentsPerVideo": {
            "title": "Root comments per video",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "How many distinct root comments to keep per video. The source serves nine across every mode and the legacy sort, so a larger number changes nothing.",
            "default": 9
          },
          "danmakuLimit": {
            "title": "Danmaku per video",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Cap on danmaku rows per video. The server enforces its own maxlimit and the segment endpoint serves only four six-minute segments, so a large value does not guarantee more rows.",
            "default": 3000
          },
          "requestDelayMs": {
            "title": "Delay between requests",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Gap between requests, in milliseconds. Bilibili answers 412 when requests to the space endpoint come too fast, so keep this above a few hundred milliseconds.",
            "default": 400
          },
          "requestTimeoutSecs": {
            "title": "Request timeout",
            "minimum": 5,
            "maximum": 180,
            "type": "integer",
            "description": "Per-request timeout in seconds.",
            "default": 25
          },
          "runBudgetSecs": {
            "title": "Run budget",
            "minimum": 30,
            "maximum": 3600,
            "type": "integer",
            "description": "Wall-clock budget. The run stops requesting once it is spent and still writes the rows it already collected."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}