{
  "openapi": "3.0.1",
  "info": {
    "title": "Bilibili Scraper - Videos, Bilibili Danmaku & Comments (B站)",
    "description": "Returns Bilibili videos, comments and danmaku. Each video: views, likes, coins, favorites, shares, danmaku and comment counts, author; tags in search and creators. Search up to 5,000 per term, trending, rankings, creators, comments with replies, danmaku profiles. B站, no login. $2 per 1,000 videos.",
    "version": "0.1",
    "x-build-id": "6Q8z4s9JH1HzP4d0S"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/improved_knot_vyk~bilibili-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-improved_knot_vyk-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/improved_knot_vyk~bilibili-scraper/runs": {
      "post": {
        "operationId": "runs-sync-improved_knot_vyk-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/improved_knot_vyk~bilibili-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-improved_knot_vyk-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",
              "videos",
              "comments",
              "popular",
              "ranking",
              "creators"
            ],
            "type": "string",
            "description": "Search videos by keyword, get specific videos by URL, only the comments of given videos, trending videos, the top 100 ranking, or creators with their videos.",
            "default": "search"
          },
          "searchTerms": {
            "title": "Search terms",
            "type": "array",
            "description": "Keywords to search, one per line (Chinese or English). Used in Search mode.",
            "items": {
              "type": "string"
            }
          },
          "videoUrls": {
            "title": "Video URLs or BV ids",
            "type": "array",
            "description": "Links like https://www.bilibili.com/video/BV1GApX6hEXE or bare BV ids. Used in Videos and Comments modes.",
            "items": {
              "type": "string"
            }
          },
          "creatorUrls": {
            "title": "Creator URLs or ids",
            "type": "array",
            "description": "Links like https://space.bilibili.com/546195 or bare numeric ids. Used in Creators mode.",
            "items": {
              "type": "string"
            }
          },
          "maxItems": {
            "title": "Max videos",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Per search term, per creator (0 = profile only), or in total for trending and ranking. Search goes up to 5,000 per term (past 1,000 it walks back in 30-day windows); ranking up to 100.",
            "default": 50
          },
          "sort": {
            "title": "Search order",
            "enum": [
              "relevance",
              "views",
              "newest",
              "danmaku",
              "favorites"
            ],
            "type": "string",
            "description": "Order of search results.",
            "default": "relevance"
          },
          "duration": {
            "title": "Video length (search)",
            "enum": [
              "any",
              "under10",
              "10to30",
              "30to60",
              "over60"
            ],
            "type": "string",
            "description": "Filter search results by length.",
            "default": "any"
          },
          "publishedAfter": {
            "title": "Published after (search)",
            "type": "string",
            "description": "Only videos published on or after this date, YYYY-MM-DD."
          },
          "publishedBefore": {
            "title": "Published before (search)",
            "type": "string",
            "description": "Only videos published on or before this date, YYYY-MM-DD."
          },
          "searchAliases": {
            "title": "Extra search terms",
            "type": "array",
            "description": "More queries searched together with each term (for example a brand's Chinese name). Results are merged and duplicates removed.",
            "items": {
              "type": "string"
            }
          },
          "autoLocalize": {
            "title": "Also search the Chinese brand name",
            "type": "boolean",
            "description": "For well-known brands typed in English (apple, nike, tesla...), also search their Chinese name (苹果, 耐克, 特斯拉).",
            "default": true
          },
          "rankingCategory": {
            "title": "Ranking category",
            "enum": [
              "all",
              "anime",
              "music",
              "dance",
              "gaming",
              "knowledge",
              "tech",
              "sports",
              "cars",
              "life",
              "food",
              "animals",
              "kichiku",
              "fashion",
              "entertainment",
              "movies"
            ],
            "type": "string",
            "description": "Category of the top 100 ranking. Used in Ranking mode.",
            "default": "all"
          },
          "includeDetails": {
            "title": "Full stats and tags",
            "type": "boolean",
            "description": "Open each video for coins, shares, likes and tags, at the same price. On by default: search and creator lists lack coins and shares. Trending and ranking already include them. Turn off for faster runs with list data only.",
            "default": true
          },
          "includeComments": {
            "title": "Include comments",
            "type": "boolean",
            "description": "Add comments and their replies for each video. Without login Bilibili shows the top 3 comments per video; their replies come complete.",
            "default": false
          },
          "maxComments": {
            "title": "Max comments per video",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Comments plus replies per video.",
            "default": 20
          },
          "commentSort": {
            "title": "Comment order",
            "enum": [
              "hot",
              "newest"
            ],
            "type": "string",
            "description": "Which comments come first.",
            "default": "hot"
          },
          "includeReplies": {
            "title": "Include replies",
            "type": "boolean",
            "description": "Add replies under each comment.",
            "default": true
          },
          "includeDanmaku": {
            "title": "Include danmaku profile",
            "type": "boolean",
            "description": "One row per video summarizing its danmaku (on-screen comments): how many, unique senders, per-minute rate, peak minute and a sample of texts across the timeline.",
            "default": false
          },
          "danmakuSampleSize": {
            "title": "Danmaku sample size",
            "minimum": 0,
            "maximum": 500,
            "type": "integer",
            "description": "Danmaku texts in the sample, spread across the video.",
            "default": 25
          },
          "sentiment": {
            "title": "Sentiment",
            "type": "boolean",
            "description": "Add a simple sentiment (positive, negative or neutral, score -1 to +1) to comments and danmaku profiles. Lexicon-based for Chinese and English.",
            "default": false
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Usually not needed. Without a proxy, the Actor switches to Apify Proxy by itself if Bilibili blocks a request.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}