{
  "openapi": "3.0.1",
  "info": {
    "title": "Bilibili 哔哩哔哩 Video Scraper",
    "description": "Scrape Bilibili videos, creators, comments and danmaku by keyword, video ID or creator ID. Every row carries kind, bvid, title, owner_name, view, like and reply, plus comment message and danmaku progress_ms. Export JSON, CSV or Excel.",
    "version": "0.1",
    "x-build-id": "88dV1gWPDq4hXVCl0"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/herus13~bilibili-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-herus13-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/herus13~bilibili-scraper/runs": {
      "post": {
        "operationId": "runs-sync-herus13-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/herus13~bilibili-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-herus13-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",
              "creator",
              "creator_videos",
              "comments",
              "fans",
              "dynamics",
              "danmaku",
              "media"
            ],
            "type": "string",
            "description": "Which kind of record to collect: `search` finds videos by keyword; `video` returns full stats for specific videos; `creator` returns a creator's profile and follower count; `creator_videos` lists a creator's uploads; `comments` returns a video's comments; `fans` lists a creator's followers; `dynamics` reads a creator's feed; `danmaku` returns a video's on-screen bullet comments; `media` returns a download link for the video or its audio. Default search.",
            "default": "search"
          },
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Search terms, one per entry — for example `python`. Each term returns up to `max_items` videos, ranked the way `order` says. Bilibili search ignores capitals, so terms that differ only in capitals or surrounding spaces are searched, and billed, once. Used when `mode` is search; leave empty for every other mode.",
            "items": {
              "type": "string"
            }
          },
          "video_ids": {
            "title": "Video IDs or URLs",
            "type": "array",
            "description": "Videos to work on, one per entry, as a BV id (`BV1wD4y1o7AS`), an av id (`av712020469`) or the video part of a bilibili.com URL — the two id styles name the same video and both work. Used when `mode` is video, comments, danmaku or media; leave empty for every other mode.",
            "items": {
              "type": "string"
            }
          },
          "creator_ids": {
            "title": "Creator IDs (mid)",
            "type": "array",
            "description": "Creators to work on, one numeric mid per entry — the number in a `space.bilibili.com/12345` URL. Used when `mode` is creator, creator_videos, fans or dynamics; leave empty for every other mode.",
            "items": {
              "type": "string"
            }
          },
          "max_items": {
            "title": "Max items per target",
            "minimum": 1,
            "type": "integer",
            "description": "How many records to return per keyword, video or creator, at least 1. Default 100. Comments: counts top-level comments only; with `include_replies` their replies (up to `max_replies_per_comment` each) come on top, so a run can return and bill more rows than this. Danmaku: applies to each six-minute stretch of a video, not the whole video, and with `danmaku_all_parts` to each stretch of every part read, so a long video returns more rows than this.",
            "default": 100
          },
          "order": {
            "title": "Search order",
            "enum": [
              "totalrank",
              "click",
              "pubdate",
              "dm",
              "stow"
            ],
            "type": "string",
            "description": "How search results are ranked: totalrank for best match, click for most viewed, pubdate for newest, dm for most bullet comments, stow for most favourited. Default totalrank. Used when `mode` is search.",
            "default": "totalrank"
          },
          "duration": {
            "title": "Video length",
            "enum": [
              "any",
              "under_10m",
              "10_30m",
              "30_60m",
              "over_60m"
            ],
            "type": "string",
            "description": "Keep only search results of this length: any for no filter, under_10m for under ten minutes, 10_30m, 30_60m, over_60m for over an hour. Default any. Used when `mode` is search.",
            "default": "any"
          },
          "tid": {
            "title": "Category ID",
            "type": "integer",
            "description": "Bilibili category to restrict a search to, given as the numeric tid that appears in a category page's URL. Leave empty to search every category. Used when `mode` is search."
          },
          "include_replies": {
            "title": "Include replies",
            "type": "boolean",
            "description": "Also collect the replies under each comment, as extra rows whose `parent_rpid` names the comment they belong to. Default false, which returns top-level comments only. Used when `mode` is comments.",
            "default": false
          },
          "max_replies_per_comment": {
            "title": "Max replies per comment",
            "minimum": 1,
            "type": "integer",
            "description": "Most replies to collect under one comment, at least 1. Default 20. It does nothing unless `include_replies` is true.",
            "default": 20
          },
          "danmaku_all_parts": {
            "title": "Danmaku from every part",
            "type": "boolean",
            "description": "Read danmaku from every part of a multi-part video (a course or series uploaded as one video), up to `max_parts` parts, instead of part 1 only. Each row's `part` and `parts_total` say which part it came from out of how many (part 3 of 200). Default false. Used when `mode` is danmaku.",
            "default": false
          },
          "max_parts": {
            "title": "Max parts per video",
            "minimum": 1,
            "type": "integer",
            "description": "Most parts of one multi-part video to read danmaku from, counting from part 1, at least 1. Default 10. Every part adds its own requests and rows, so raise it with care on long courses. It does nothing unless `danmaku_all_parts` is true.",
            "default": 10
          },
          "quality": {
            "title": "Media quality",
            "enum": [
              "best",
              "720p",
              "480p"
            ],
            "type": "string",
            "description": "Which stream to download: best for the highest the video offers, 720p or 480p to cap it at that resolution. Default best. A video that offers nothing at the resolution you ask for returns the best one below it, never a larger file than you asked for. Used when `mode` is media.",
            "default": "best"
          },
          "audio_only": {
            "title": "Audio only",
            "type": "boolean",
            "description": "Download the audio track on its own instead of the video file — far smaller, and enough for transcription or music. Default false. Used when `mode` is media.",
            "default": false
          },
          "auth": {
            "title": "Your own login cookies",
            "type": "object",
            "description": "Your own Bilibili cookies, as {\"cookies\": \"SESSDATA=...\"}, if you want the run to act as your own account — for instance to reach media resolutions Bilibili reserves for members. Leave empty and you need no account at all."
          },
          "proxyUrls": {
            "title": "Your own proxy URLs (optional)",
            "type": "array",
            "description": "Leave empty and the run uses the residential proxy this actor ships with, included in the price of the run. To route the run through your own account instead, add one gateway URL per entry, for example http://user:pass@host:port — works with DataImpulse, Bright Data, Oxylabs, Smartproxy or any provider that issues URLs. When set, only these URLs are used.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}