{
  "openapi": "3.0.1",
  "info": {
    "title": "Bilibili Scraper (B站) — Videos, Comments, Danmaku & Subtitles",
    "description": "Scrape Bilibili (哔哩哔哩, B站) without login: keyword search past the 1,000 cap, full video stats, UP主 profiles and full catalogs, comments, danmaku (弹幕), AI subtitles (字幕), trending and hot search. Delta mode for monitoring. B站数据采集。",
    "version": "1.0",
    "x-build-id": "dqqNAeluuiRi2Ik3h"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/rastriq~bilibili-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-rastriq-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/rastriq~bilibili-scraper/runs": {
      "post": {
        "operationId": "runs-sync-rastriq-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/rastriq~bilibili-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-rastriq-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 on Bilibili (Chinese works best, e.g. <code>原神</code>, <code>新能源汽车</code>). Each keyword is a separate search.",
            "items": {
              "type": "string"
            }
          },
          "searchType": {
            "title": "Search for",
            "enum": [
              "video",
              "user"
            ],
            "type": "string",
            "description": "Search videos or creator accounts.",
            "default": "video"
          },
          "startUrls": {
            "title": "🔗 Video or creator URLs / IDs",
            "type": "array",
            "description": "Video URLs, <code>BV…</code> or <code>av…</code> IDs, creator space URLs (<code>space.bilibili.com/…</code>) or creator mids.",
            "items": {
              "type": "string"
            }
          },
          "creatorVideos": {
            "title": "Get all videos of each creator",
            "type": "boolean",
            "description": "For creators given as URLs/mids (or found with creator search), list their uploaded videos from newest to oldest. Combine with <b>Published after</b> to stop at a date.",
            "default": false
          },
          "maxVideosPerCreator": {
            "title": "Max videos per creator",
            "minimum": 0,
            "type": "integer",
            "description": "0 = all videos (full catalog).",
            "default": 100
          },
          "trendingLists": {
            "title": "📈 Trending lists",
            "type": "array",
            "description": "Trending boards to collect.",
            "items": {
              "type": "string",
              "enum": [
                "popular",
                "ranking",
                "weekly",
                "precious",
                "hot_search"
              ],
              "enumTitles": [
                "Popular now (综合热门)",
                "Ranking top 100 (排行榜)",
                "Weekly must-watch (每周必看)",
                "All-time must-watch (入站必刷)",
                "Hot search keywords (热搜)"
              ]
            },
            "default": []
          },
          "maxResults": {
            "title": "Max results (total)",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum videos, searched/URL creators and hot-search rows across the run. Creator profiles added via enrichment, comments and danmaku are capped by their own settings. 0 = no limit.",
            "default": 100
          },
          "maxResultsPerSource": {
            "title": "Max results per keyword / list",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Cap per keyword or per trending list. Bilibili search returns up to 1,000 per query; use date slicing below to go further.",
            "default": 100
          },
          "fetchVideoDetails": {
            "title": "Full video details",
            "type": "boolean",
            "description": "Fetch coins, shares, exact likes, category, all tags, cid, honors and publish location for every video (one extra request per search result).",
            "default": true
          },
          "includeCreatorProfiles": {
            "title": "Add creator (UP主) profiles",
            "type": "boolean",
            "description": "Emit one creator record per unique uploader found (followers, total likes, video count, verification).",
            "default": false
          },
          "includeComments": {
            "title": "Include comments",
            "type": "boolean",
            "description": "Emit comment records per video (hot comments, pinned comment and replies).",
            "default": false
          },
          "maxCommentsPerVideo": {
            "title": "Max comments per video",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Maximum comment records (top-level + replies) per video.",
            "default": 20
          },
          "commentSort": {
            "title": "Comment order",
            "enum": [
              "hot",
              "newest"
            ],
            "type": "string",
            "description": "Order of top-level comments. Use <b>Newest first</b> for monitoring with delta mode.",
            "default": "hot"
          },
          "includeCommentReplies": {
            "title": "Include replies to comments",
            "type": "boolean",
            "description": "Also fetch replies under each top-level comment.",
            "default": true
          },
          "includeDanmaku": {
            "title": "Include danmaku (弹幕)",
            "type": "boolean",
            "description": "Emit bullet comments with video timestamp, color, mode and send time (first part of each video).",
            "default": false
          },
          "maxDanmakuPerVideo": {
            "title": "Max danmaku per video",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Maximum danmaku records per video, ordered by video timestamp.",
            "default": 1000
          },
          "includeSubtitles": {
            "title": "Include subtitles / transcripts (字幕)",
            "type": "boolean",
            "description": "Emit one record per subtitle track (creator-uploaded and Bilibili AI subtitles) with full text and timed segments. Not every video has subtitles.",
            "default": false
          },
          "subtitleLanguages": {
            "title": "Subtitle languages",
            "type": "array",
            "description": "Optional filter by track code, e.g. <code>ai-zh</code>, <code>zh-Hans</code>, <code>en-US</code>. Empty = all tracks.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "sortBy": {
            "title": "Sort videos by",
            "enum": [
              "totalrank",
              "click",
              "pubdate",
              "dm",
              "stow",
              "scores"
            ],
            "type": "string",
            "description": "Order of video search results.",
            "default": "totalrank"
          },
          "durationFilter": {
            "title": "Duration",
            "enum": [
              "0",
              "1",
              "2",
              "3",
              "4"
            ],
            "type": "string",
            "description": "Only videos within this duration range.",
            "default": "0"
          },
          "categoryId": {
            "title": "Category ID (tids)",
            "minimum": 0,
            "type": "integer",
            "description": "Optional Bilibili category id to restrict video search (0 = all).",
            "default": 0
          },
          "publishedAfter": {
            "title": "Published after",
            "type": "string",
            "description": "Only videos published on/after this date (UTC)."
          },
          "publishedBefore": {
            "title": "Published before",
            "type": "string",
            "description": "Only videos published on/before this date (UTC)."
          },
          "searchSliceDays": {
            "title": "Date slicing (days per window)",
            "minimum": 0,
            "maximum": 365,
            "type": "integer",
            "description": "Split the date range into windows of N days and search each one, to get past Bilibili's 1,000-results-per-query cap. Requires <b>Published after</b>. 0 = off.",
            "default": 0
          },
          "rankingCategory": {
            "title": "Ranking category (rid)",
            "minimum": 0,
            "type": "integer",
            "description": "Category for the Ranking list (0 = all).",
            "default": 0
          },
          "deltaMode": {
            "title": "Only new items (delta mode)",
            "type": "boolean",
            "description": "Remember what previous runs returned and output (and charge) only new videos, comments, danmaku and subtitles. Creator profiles and hot searches are always returned. The first run is the baseline and returns everything. Ideal for scheduled runs.",
            "default": false
          },
          "deltaStateName": {
            "title": "Delta state name",
            "type": "string",
            "description": "Use a different name per monitoring job (e.g. <code>brand-x</code>), so jobs don't share memory. Stored in your account as key-value store <code>bilibili-delta-&lt;name&gt;</code>.",
            "default": "default"
          },
          "includeRawData": {
            "title": "Include raw Bilibili data",
            "type": "boolean",
            "description": "Add a <code>raw</code> object to each record with the complete original Bilibili response, so no field is ever lost. Turn off for lighter exports. Commenter identities in <code>raw</code> follow the privacy setting below.",
            "default": true
          },
          "includeCommenterIdentity": {
            "title": "Include commenter usernames and mids",
            "type": "boolean",
            "description": "By default commenters and danmaku senders are pseudonymised (<code>author_hash</code>, <code>sender_hash</code>). Enable to get commenter usernames and mids and Bilibili's raw danmaku sender hash — only if you have a lawful basis to process personal data.",
            "default": false
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 8,
            "type": "integer",
            "description": "Parallel requests to Bilibili. Higher is faster but more likely to be rate limited.",
            "default": 3
          },
          "proxyUrl": {
            "title": "Proxy URL (optional)",
            "type": "string",
            "description": "Optional HTTP proxy, e.g. <code>http://user:pass@host:port</code>. Not needed for normal volumes."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}