{
  "openapi": "3.0.1",
  "info": {
    "title": "YouTube Scraper — Videos, Channels, Playlists, Comments",
    "description": "Scrapes YouTube search results, video details, channels, playlists and comments — views, likes, descriptions, durations, subscriber counts and full comment threads. No login or API key. Does not download video or transcripts (YouTube gates those behind a browser-only token).",
    "version": "0.1",
    "x-build-id": "OVR95OjZTJqnMBfYA"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapyx~youtube-data-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapyx-youtube-data-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/scrapyx~youtube-data-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapyx-youtube-data-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/scrapyx~youtube-data-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapyx-youtube-data-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",
              "channel",
              "playlist",
              "comments"
            ],
            "type": "string",
            "description": "Decides what your `queries` mean and what rows you get back.\n\n• **Search** — search terms → video results\n• **Video details** — video IDs/URLs → one rich row each (views, likes, description, channel)\n• **Channel** — channel IDs/@handles/URLs → a channel row plus its videos, shorts or live streams\n• **Playlist** — playlist IDs/URLs → a playlist row plus its videos\n• **Comments** — video IDs/URLs → comment rows",
            "default": "search"
          },
          "queries": {
            "title": "Queries / URLs",
            "type": "array",
            "description": "One entry per thing to scrape. What goes here depends on the mode:\n\n• **Search** — plain search terms, e.g. `python tutorial`\n• **Video details / Comments** — an 11-character video ID or any video URL (`watch?v=`, `youtu.be/`, `/shorts/`, `/embed/`, `/live/`)\n• **Channel** — a `UC…` channel ID, an `@handle`, or a channel URL (legacy `/c/` and `/user/` URLs work too)\n• **Playlist** — a playlist ID (`PL…`, `UU…`, …) or any URL with a `list=` parameter",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "maxItems": {
            "title": "Max results per query",
            "minimum": 0,
            "type": "integer",
            "description": "Videos per search/channel/playlist, or comments per video. Set to 0 for as many as YouTube will page through. Results are paged in chunks (search ~12–14, channel 30, comments 20), so the actual count lands on a chunk boundary at or above your number.",
            "default": 50
          },
          "channelTab": {
            "title": "Channel tab",
            "enum": [
              "videos",
              "shorts",
              "streams"
            ],
            "type": "string",
            "description": "Which tab to read in Channel mode. Note that **Shorts carry no publish date and no duration** — YouTube's shorts shelf simply doesn't include them, so those fields come back empty (and the run says so in its summary row).",
            "default": "videos"
          },
          "searchFilter": {
            "title": "Search filter",
            "enum": [
              "",
              "video",
              "channel",
              "playlist",
              "movie",
              "today",
              "this_week",
              "this_month"
            ],
            "type": "string",
            "description": "Optional filter for Search mode, matching YouTube's own filter chips. Leave blank for unfiltered results.",
            "default": ""
          },
          "commentSort": {
            "title": "Comment sort",
            "enum": [
              "top",
              "newest"
            ],
            "type": "string",
            "description": "Order for Comments mode: YouTube's own \"Top comments\" ranking, or newest first.",
            "default": "top"
          },
          "includeChannelVideos": {
            "title": "Include the channel's videos",
            "type": "boolean",
            "description": "In Channel mode, also page through the selected tab. Turn this off to fetch only the channel profile row (title, description, subscriber count, avatar, banner) — one request instead of many.",
            "default": true
          },
          "language": {
            "title": "Language (hl)",
            "type": "string",
            "description": "Interface language for titles and metadata YouTube localises, as an ISO code — `en`, `es`, `id`, `de`.",
            "default": "en"
          },
          "country": {
            "title": "Country (gl)",
            "type": "string",
            "description": "Country context as a two-letter code — `US`, `GB`, `ID`. Affects which results YouTube considers relevant.",
            "default": "US"
          },
          "maxConcurrency": {
            "title": "Max concurrent requests",
            "minimum": 1,
            "maximum": 16,
            "type": "integer",
            "description": "Upper bound on requests in flight at once, across all queries. Keep this modest: YouTube answers a hot IP with a rate-limit interstitial rather than a clean error.",
            "default": 4
          },
          "minRequestInterval": {
            "title": "Minimum seconds between request starts",
            "minimum": 0,
            "maximum": 30,
            "type": "number",
            "description": "The honest speed control — it paces request starts without tying up a worker. Raise it (0.5–2) if the log shows rate-limit warnings; once this cap binds, extra concurrency buys nothing.",
            "default": 0.25
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Off by default — these endpoints answer a datacenter IP fine. Enable it if you scrape heavily and start seeing rate-limit warnings, or if you need results from a specific country.",
            "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}