{
  "openapi": "3.0.1",
  "info": {
    "title": "Bilibili Scraper: Videos, Search, Rankings & Danmaku (No Login)",
    "description": "Scrape Bilibili (哔哩哔哩 / B站) videos by URL, keyword search or Top 100 ranking: views, likes, coins, favorites, tags, channel, plus full-timeline danmaku (bullet comments) with reaction peaks. No login, no cookies.",
    "version": "0.1",
    "x-build-id": "7Bsyoixd40YDQG70M"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/cn-data-lab~bilibili-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-cn-data-lab-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/cn-data-lab~bilibili-scraper/runs": {
      "post": {
        "operationId": "runs-sync-cn-data-lab-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/cn-data-lab~bilibili-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-cn-data-lab-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": {
          "videoUrls": {
            "title": "Video URLs or IDs",
            "type": "array",
            "description": "Bilibili video URLs (bilibili.com/video/BV..., m.bilibili.com, b23.tv short links) or plain BV / av IDs.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "searchKeywords": {
            "title": "Search keywords",
            "type": "array",
            "description": "Search Bilibili videos by keyword (Chinese or English), e.g. 原神, Black Myth Wukong, iPhone 17 测评.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "maxVideosPerKeyword": {
            "title": "Max videos per keyword",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "How many search results to scrape per keyword (Bilibili returns up to 1,000 results per query).",
            "default": 20
          },
          "searchOrder": {
            "title": "Search sort order",
            "enum": [
              "totalrank",
              "click",
              "pubdate",
              "dm",
              "stow"
            ],
            "type": "string",
            "description": "How search results are sorted.",
            "default": "totalrank"
          },
          "includeRanking": {
            "title": "Scrape trending ranking (排行榜)",
            "type": "boolean",
            "description": "Also scrape the official Bilibili Top 100 ranking.",
            "default": false
          },
          "rankingCategoryId": {
            "title": "Ranking category ID",
            "type": "integer",
            "description": "0 = all categories. Examples: 1 anime/MAD, 3 music, 4 games, 36 knowledge, 188 tech, 160 lifestyle, 211 food, 217 animals, 119 kichiku, 129 dance, 181 film & TV.",
            "default": 0
          },
          "maxRankingVideos": {
            "title": "Max ranking videos",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "How many videos to take from the ranking (max 100).",
            "default": 100
          },
          "scrapeDanmaku": {
            "title": "Scrape danmaku (bullet comments, 弹幕)",
            "type": "boolean",
            "description": "Download danmaku across the whole video timeline. Each danmaku is saved as its own dataset item, and each video gets a reaction timeline + peak moments.",
            "default": false
          },
          "maxDanmakuPerVideo": {
            "title": "Max danmaku per video",
            "minimum": 0,
            "type": "integer",
            "description": "Upper limit of danmaku items saved per video (charged per item).",
            "default": 1000
          },
          "danmakuTimelineBucketSec": {
            "title": "Timeline bucket size (seconds)",
            "minimum": 1,
            "type": "integer",
            "description": "Bucket size used for the danmaku reaction timeline and peak detection.",
            "default": 30
          },
          "includeTags": {
            "title": "Include video tags",
            "type": "boolean",
            "description": "Add the uploader's tags to each video.",
            "default": true
          },
          "includeTopComments": {
            "title": "Include top comments preview",
            "type": "boolean",
            "description": "Add the top hot comments (Bilibili shows guests a short preview, up to 3) to each video item. No extra charge.",
            "default": false
          },
          "includeCommentAuthor": {
            "title": "Include comment author nicknames",
            "type": "boolean",
            "description": "By default no commenter identities are stored. Enable only if you have a lawful basis to process them.",
            "default": false
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Parallel video requests. Keep it low (2-4) to stay polite and avoid rate limiting.",
            "default": 3
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional. Usually not needed. Use it only if you see rate-limit errors.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}