{
  "openapi": "3.0.1",
  "info": {
    "title": "Bilibili Scraper (B站 哔哩哔哩) - Videos, Comments, Danmaku",
    "description": "Scrape Bilibili (B站 / 哔哩哔哩) without login or cookies: video search beyond the 1,000-result cap, video details, creator videos and profiles, popular feed, full comment threads with replies, danmaku (弹幕) analytics. From $2 per 1,000 results.",
    "version": "0.1",
    "x-build-id": "4WQsXYehA5nE2vf5E"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/alom~bilibili-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-alom-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/alom~bilibili-scraper/runs": {
      "post": {
        "operationId": "runs-sync-alom-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/alom~bilibili-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-alom-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": {
          "mode": {
            "title": "What to scrape",
            "enum": [
              "search",
              "video_detail",
              "video_comments",
              "user_videos",
              "user_profile",
              "popular"
            ],
            "type": "string",
            "description": "Pick one mode. Each mode uses the matching field below.",
            "default": "search"
          },
          "searchQuery": {
            "title": "Search keyword",
            "type": "string",
            "description": "Keyword for <b>search</b> mode, in Chinese or English (e.g. <code>人工智能</code>, <code>minecraft</code>)."
          },
          "searchQueries": {
            "title": "More search keywords",
            "type": "array",
            "description": "Optional: several keywords in one run. Each keyword gets up to <b>Max results</b> videos.",
            "items": {
              "type": "string"
            }
          },
          "sortOrder": {
            "title": "Sort by",
            "enum": [
              "totalrank",
              "click",
              "pubdate",
              "dm",
              "stow"
            ],
            "type": "string",
            "description": "Search result order.",
            "default": "totalrank"
          },
          "durationFilter": {
            "title": "Video length",
            "enum": [
              "any",
              "0-10",
              "10-30",
              "30-60",
              "60+"
            ],
            "type": "string",
            "description": "Search only.",
            "default": "any"
          },
          "pubtimeBegin": {
            "title": "Published from",
            "type": "string",
            "description": "Search only: videos published on or after this date (China time)."
          },
          "pubtimeEnd": {
            "title": "Published until",
            "type": "string",
            "description": "Search only: videos published on or before this date (China time)."
          },
          "videoUrls": {
            "title": "Video URLs or BV ids",
            "type": "array",
            "description": "For <b>video details</b> and <b>video comments</b>: full URLs, <code>BV...</code> ids, <code>av...</code> ids or <code>b23.tv</code> short links.",
            "items": {
              "type": "string"
            }
          },
          "userIds": {
            "title": "Creator ids (mid) or space URLs",
            "type": "array",
            "description": "For <b>creator videos</b> and <b>creator profiles</b>: e.g. <code>546195</code>, <code>https://space.bilibili.com/546195</code> or a <code>b23.tv</code> short link to a creator's space.",
            "items": {
              "type": "string"
            }
          },
          "category": {
            "title": "Popular: category",
            "enum": [
              "all",
              "animation",
              "game",
              "music",
              "dance",
              "knowledge",
              "tech",
              "sports",
              "fitness",
              "car",
              "life",
              "food",
              "animal",
              "fashion",
              "entertainment",
              "film",
              "kichiku",
              "news"
            ],
            "type": "string",
            "description": "For <b>popular</b> mode: keep only this category.",
            "default": "all"
          },
          "maxResults": {
            "title": "Max results",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Maximum videos per keyword, per creator, or for the popular feed. Bilibili caps one search at ~1,000 videos; above that, search automatically continues through date windows (newest first) until this number is reached.",
            "default": 50
          },
          "includeComments": {
            "title": "Add comments to each video",
            "type": "boolean",
            "description": "Also return each video's comments as rows (<code>type: comment</code>), 20 per page in Bilibili's own order, up to <b>Max comments per video</b>. No login needed. Each comment is one result, so this multiplies the rows (and the cost) of a run: cap it with <b>Max comments per video</b>.",
            "default": false
          },
          "includeReplies": {
            "title": "Include full reply threads",
            "type": "boolean",
            "description": "Also return the replies under each comment, one row each, tagged with <code>rootRpid</code> / <code>isThreadReply</code>. When a comment has more replies than Bilibili previews, the whole thread is paged (20 per request) until <b>Max comments per video</b> is reached. Replies are billed as normal comment rows.",
            "default": false
          },
          "maxComments": {
            "title": "Max comments per video",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Upper limit per video, counting comments and replies together.",
            "default": 20
          },
          "sortComments": {
            "title": "Comment order",
            "enum": [
              "hot",
              "time"
            ],
            "type": "string",
            "description": "Which comments to prefer.",
            "default": "hot"
          },
          "includeTags": {
            "title": "Fetch tags in video details",
            "type": "boolean",
            "description": "Video details mode: one extra request per video for its tags.",
            "default": true
          },
          "includeDanmaku": {
            "title": "Add a danmaku (弹幕) profile to each video",
            "type": "boolean",
            "description": "One extra row per video (<code>type: danmaku</code>) that reduces the video's on-screen comments to reaction metrics: danmaku fetched vs the video's total, unique senders, danmaku per minute, the <b>peak minute</b> and its count, a per-minute histogram, first/last positions, and a text sample spread evenly across the timeline. Bilibili keeps a capped pool of danmaku per video (e.g. 3,600 of 128,575), and the row says so (<code>danmakuPoolCapped</code>). <b>Billed as a separate danmaku-profile event</b> (see Pricing); off by default. Works in search, video details, creator videos and popular modes.",
            "default": false
          },
          "danmakuSampleSize": {
            "title": "Danmaku sample size",
            "minimum": 0,
            "maximum": 500,
            "type": "integer",
            "description": "How many danmaku texts to include in each profile row, spread evenly across the video. 0 = metrics only. The sample stays inside the one row, so it does not add rows or cost.",
            "default": 25
          },
          "deltaMode": {
            "title": "Only new videos since my last run (monitoring)",
            "type": "boolean",
            "description": "Skip videos an earlier run with the same state key already returned. Works in search, popular and creator-videos modes. Pair with a Schedule.",
            "default": false
          },
          "monitorName": {
            "title": "Monitor name",
            "type": "string",
            "description": "Keep separate memories for different monitors (e.g. <code>nike-weekly</code>). Defaults to <code>default</code>."
          },
          "sessdataCookie": {
            "title": "Your own Bilibili SESSDATA cookie (optional, at your own risk)",
            "type": "string",
            "description": "<b>Not needed for normal use</b>: comments and reply threads already work without login. If you paste the value of the <code>SESSDATA</code> cookie of <b>your own</b> Bilibili account, it is checked once and then sent <b>only with comment and reply requests</b>, as a logged-in visitor would. It is stored encrypted and never logged or returned. <b>Use at your own risk</b>: automated requests from a logged-in account can get that account rate-limited or restricted by Bilibili. An expired or wrong value is ignored (the run says so) and comments are fetched without login. Leave empty to not use it."
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Parallel requests for video/creator lists.",
            "default": 3
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Default Apify datacenter proxy works well and is included in the price.",
            "default": {
              "useApifyProxy": true
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}