{
  "openapi": "3.0.1",
  "info": {
    "title": "Bilibili Scraper - Videos, Trending, Comments & Creator Leads",
    "description": "Scrape Bilibili videos by keyword, trending feeds and partition leaderboards, full comment threads, and creator (UP) profiles with follower reach, extracted business contacts and lead scores. Pure HTTP, no login and no browser.",
    "version": "0.1",
    "x-build-id": "Z5MLm3MhW4f4R5kMq"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapesage~bilibili-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapesage-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/scrapesage~bilibili-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapesage-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/scrapesage~bilibili-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapesage-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",
              "trending",
              "videos",
              "creators",
              "comments"
            ],
            "type": "string",
            "description": "One mode per run, and one record type per mode - so the CSV/Excel export always has clean columns. Video search, Trending & rankings and Specific videos all produce VIDEO rows. Creators produces CREATOR rows (with contact extraction and a lead score). Comments produces COMMENT rows.",
            "default": "search"
          },
          "keywords": {
            "title": "Search keywords",
            "type": "array",
            "description": "Keywords to search Bilibili for. Chinese and English both work (e.g. 美食, Minecraft, iPhone). Bilibili caps one keyword+sort combination at about 1,000 results; leave 'Search all sort orders' on and the scraper cycles the sort orders and de-duplicates to push past that ceiling. Used by the Video search mode.",
            "items": {
              "type": "string"
            }
          },
          "searchOrder": {
            "title": "Sort results by",
            "enum": [
              "totalrank",
              "click",
              "pubdate",
              "dm",
              "stow",
              "scores"
            ],
            "type": "string",
            "description": "Which Bilibili sort order to start from.",
            "default": "totalrank"
          },
          "deepSearch": {
            "title": "Search all sort orders (recommended)",
            "type": "boolean",
            "description": "Bilibili returns at most ~1,000 results per keyword per sort order. With this on, the scraper walks every sort order for each keyword and de-duplicates by video ID, which reaches several thousand unique videos per keyword instead of one thousand.",
            "default": true
          },
          "searchDuration": {
            "title": "Duration filter",
            "enum": [
              "0",
              "1",
              "2",
              "3",
              "4"
            ],
            "type": "string",
            "description": "Only return videos in this length band.",
            "default": "0"
          },
          "searchPartitionId": {
            "title": "Limit to a partition (分区) ID",
            "minimum": 0,
            "type": "integer",
            "description": "Optional Bilibili partition/category ID, e.g. 4 = Gaming, 36 = Tech, 211 = Food, 160 = Life, 3 = Music, 129 = Dance, 188 = Digital, 234 = Sports, 223 = Cars, 155 = Fashion, 5 = Entertainment, 181 = Film & TV, 119 = Kichiku, 1 = Anime. Leave empty to search every partition."
          },
          "publishedWithinDays": {
            "title": "Published within the last N days",
            "minimum": 0,
            "maximum": 3650,
            "type": "integer",
            "description": "Only return videos published in this window, e.g. 7 for the last week. Leave at 0 for no date filter.",
            "default": 0
          },
          "trendingSource": {
            "title": "Trending source",
            "enum": [
              "popular",
              "ranking",
              "precious"
            ],
            "type": "string",
            "description": "Which of Bilibili's own discovery feeds to pull.",
            "default": "popular"
          },
          "rankingPartitions": {
            "title": "Leaderboard partitions",
            "type": "array",
            "description": "Partition IDs to pull leaderboards for, when Trending source = Leaderboard. 0 = All, 1 = Anime, 3 = Music, 4 = Gaming, 5 = Entertainment, 36 = Tech, 119 = Kichiku, 129 = Dance, 155 = Fashion, 160 = Life, 181 = Film & TV, 188 = Digital, 217 = Animals, 223 = Cars, 234 = Sports.",
            "default": [
              "0"
            ],
            "items": {
              "type": "string"
            }
          },
          "videoUrls": {
            "title": "Video URLs or IDs",
            "type": "array",
            "description": "Bilibili videos to scrape in full detail, or to pull comments for. Accepts a full URL (https://www.bilibili.com/video/BV1uv411q7Mv), a b23.tv share link, a bare BV ID (BV1uv411q7Mv) or an av ID (av243922477). Used by the Specific videos and Comments modes.",
            "items": {
              "type": "string"
            }
          },
          "commentSort": {
            "title": "Comment order",
            "enum": [
              "hot",
              "time"
            ],
            "type": "string",
            "description": "How to order comments in the Comments mode.",
            "default": "hot"
          },
          "maxCommentsPerVideo": {
            "title": "Max comments per video",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "How deep to page each video's comment thread. Each top-level comment carries its own nested sub-replies.",
            "default": 50
          },
          "creatorUrls": {
            "title": "Creator profiles (UP主)",
            "type": "array",
            "description": "Creators to scrape. Accepts a space URL (https://space.bilibili.com/946974) or a bare numeric UID (946974). Used by the Creators mode.",
            "items": {
              "type": "string"
            }
          },
          "creatorKeywords": {
            "title": "Find creators by keyword",
            "type": "array",
            "description": "Search Bilibili's creator directory instead of supplying UIDs, e.g. 美食 (food), 数码 (tech), 健身 (fitness). Every match is enriched into a full creator record with follower counts and extracted contacts.",
            "items": {
              "type": "string"
            }
          },
          "minFollowers": {
            "title": "Minimum followers",
            "minimum": 0,
            "type": "integer",
            "description": "Skip creators below this follower count. Applied to the search result before enrichment, so it also saves requests.",
            "default": 0
          },
          "includeCreatorVideos": {
            "title": "Include the creator's recent uploads",
            "type": "boolean",
            "description": "Nest the creator's latest videos into the record and compute average/median reach from them. Adds one request per creator.",
            "default": true
          },
          "maxCreatorVideos": {
            "title": "Recent uploads per creator",
            "minimum": 0,
            "maximum": 300,
            "type": "integer",
            "description": "How many of the creator's latest videos to nest into the record.",
            "default": 12
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after this many records (videos, creators or comments depending on the mode). Set to 0 for no limit - the run then stops safely on its own time budget rather than timing out.",
            "default": 100
          },
          "fullVideoDetail": {
            "title": "Fetch the complete video record (recommended)",
            "type": "boolean",
            "description": "Bilibili's search endpoint returns a reduced record. With this on, every video is hydrated from the full video API, which adds coins, shares, resolution, the episode/part list, collaborators, copyright status, the complete description, real tag objects AND the uploader's follower count, upload count, total likes, bio and verification - all in one extra request per video. Turn it off for a faster, lighter run that returns only the search-result fields.",
            "default": true
          },
          "includeTopComments": {
            "title": "Top comments to nest per video",
            "minimum": 0,
            "maximum": 50,
            "type": "integer",
            "description": "Nest this many top comments inside each video row (0 = off). Use the Comments mode instead if you want one row per comment.",
            "default": 0
          },
          "maxConcurrency": {
            "title": "Parallel requests",
            "minimum": 1,
            "maximum": 15,
            "type": "integer",
            "description": "How many enrichment requests to keep in flight. The default is tuned for Bilibili's rate limits; lower it if a very large run starts getting throttled.",
            "default": 5
          },
          "requestDelayMs": {
            "title": "Delay between requests (ms)",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Politeness delay applied between request starts. The default is tuned for Bilibili's rate limits; raise it if you see throttling on very large runs.",
            "default": 250
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Apify Proxy is used by default. The scraper runs on the cheap datacenter lane and automatically escalates only the risk-controlled endpoints to residential, so most runs cost very little proxy traffic.",
            "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}