{
  "openapi": "3.0.1",
  "info": {
    "title": "Bilibili Scraper: Video Search, Comments & Danmaku (B站)",
    "description": "Bilibili scraper for video search by keyword, full video details, comments with IP location and danmaku (bullet comments). Views, likes, coins, tags and uploader per video. Plain HTTP, no browser, no login. $8 per 1,000 videos, $2 per 1,000 comments.",
    "version": "0.1",
    "x-build-id": "U0qWtsy2OcMmSsp4Q"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/datagleaner~bilibili-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-datagleaner-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/datagleaner~bilibili-scraper/runs": {
      "post": {
        "operationId": "runs-sync-datagleaner-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/datagleaner~bilibili-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-datagleaner-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": {
          "searchKeywords": {
            "title": "Search keywords",
            "type": "array",
            "description": "Keywords to search for videos (Chinese works best, e.g. `python 教程`). Each keyword returns up to Max videos per keyword.",
            "items": {
              "type": "string"
            }
          },
          "searchOrder": {
            "title": "Search order",
            "enum": [
              "totalrank",
              "click",
              "pubdate",
              "dm",
              "stow",
              "scores"
            ],
            "type": "string",
            "description": "How Bilibili ranks search results.",
            "default": "totalrank"
          },
          "durationFilter": {
            "title": "Video length",
            "enum": [
              "any",
              "under10",
              "10to30",
              "30to60",
              "over60"
            ],
            "type": "string",
            "description": "Only return search results of this length (Bilibili's own duration filter).",
            "default": "any"
          },
          "publishedAfter": {
            "title": "Published after",
            "type": "string",
            "description": "Only return search results published on or after this date: `2026-01-31` (a whole day in China time, as on Bilibili), an ISO datetime, or a relative age such as `7 days` for a rolling window on scheduled runs."
          },
          "publishedBefore": {
            "title": "Published before",
            "type": "string",
            "description": "Only return search results published on or before this date (same formats as Published after)."
          },
          "maxItems": {
            "title": "Max videos per keyword or trending list",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Search caps out around 1,000 results per keyword (50 pages of 20).",
            "default": 30
          },
          "trendingCategory": {
            "title": "Trending videos",
            "enum": [
              "none",
              "popular"
            ],
            "type": "string",
            "description": "Also return what is trending on Bilibili now, no keyword needed (the site-wide trending feed, 综合热门, a few hundred videos). Returns up to Max videos per keyword, with full stats (coins and shares included). Works alone or with keywords and URLs.",
            "default": "none"
          },
          "enrichSearchResults": {
            "title": "Fetch full details for search results",
            "type": "boolean",
            "description": "Search results lack coins, shares and an accurate category and tag list. Turn on to fetch each video's full record (2 extra requests per video, slower).",
            "default": false
          },
          "videoUrls": {
            "title": "Video URLs or IDs",
            "type": "array",
            "description": "Bilibili video links, BV ids (`BV1xx411c7mD`) or av ids (`av170001`). Returns full details for each.",
            "items": {
              "type": "string"
            }
          },
          "userIds": {
            "title": "Creator UIDs or space URLs",
            "type": "array",
            "description": "Bilibili creators as a UID (`546195`) or a space link (`https://space.bilibili.com/546195`). Returns each creator's latest uploads, newest first, as video rows (billed as videos). Bilibili guards this list closely: if it refuses from the platform's IPs, the run says so, charges nothing for it and carries on with the other sources.",
            "items": {
              "type": "string"
            }
          },
          "maxVideosPerUser": {
            "title": "Max videos per creator",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Latest uploads returned per creator in Creator UIDs.",
            "default": 30
          },
          "includeComments": {
            "title": "Include comments",
            "type": "boolean",
            "description": "Also scrape comments for every video returned.",
            "default": false
          },
          "maxCommentsPerVideo": {
            "title": "Max comments per video",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Top-level comments per video.",
            "default": 20
          },
          "commentSort": {
            "title": "Comment order",
            "enum": [
              "hot",
              "newest"
            ],
            "type": "string",
            "description": "Order of top-level comments.",
            "default": "hot"
          },
          "includeReplies": {
            "title": "Include replies",
            "type": "boolean",
            "description": "Also scrape replies under each comment (one extra request per commented thread).",
            "default": false
          },
          "maxRepliesPerComment": {
            "title": "Max replies per comment",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Replies fetched under each comment when Include replies is on.",
            "default": 10
          },
          "includeDanmaku": {
            "title": "Include danmaku (bullet comments)",
            "type": "boolean",
            "description": "Also scrape danmaku (弹幕) for every video returned: one extra request per video part. The public XML holds the most recent danmaku pool, typically up to a few thousand per part.",
            "default": false
          },
          "maxDanmakuPerVideo": {
            "title": "Max danmaku per video",
            "minimum": 1,
            "maximum": 50000,
            "type": "integer",
            "description": "Total danmaku per video across all its parts.",
            "default": 1000
          },
          "requestDelaySecs": {
            "title": "Delay between requests (seconds)",
            "minimum": 0.5,
            "maximum": 30,
            "type": "number",
            "description": "Politeness pacing with random jitter. Lower is faster but triggers Bilibili's risk control sooner.",
            "default": 1.5
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional. Default is no proxy. Use Apify Proxy (a China or Hong Kong residential group works best) if Bilibili blocks your run."
          },
          "sessionCookie": {
            "title": "Bilibili SESSDATA cookie (optional)",
            "type": "string",
            "description": "Without login Bilibili serves only about 3 curated top comments per video. To get full comment lists, paste the SESSDATA cookie of a Bilibili account you own. Use a throwaway account: heavy scraping while logged in can get it restricted."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}