{
  "openapi": "3.0.1",
  "info": {
    "title": "YouTube Scraper With Comment & Engagement Analytics",
    "description": "🎥 YouTube Scraper extracts data from channels, videos & playlists — titles, descriptions, views, likes, comments, tags, publish date & transcripts. 🔍 Ideal for SEO, competitor analysis, trend tracking & content planning. ⚡ Fast, reliable, export to CSV/JSON.",
    "version": "0.1",
    "x-build-id": "152cS9MPOlnKb33WP"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapio~youtube-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapio-youtube-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/scrapio~youtube-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapio-youtube-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/scrapio~youtube-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapio-youtube-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": {
          "searchQueries": {
            "title": "🔍 Search queries",
            "type": "array",
            "description": "One or more YouTube search keywords (e.g. \"Crawlee\", \"fitness workout\"). The actor scrapes matching videos/shorts/streams for each keyword and runs full engagement analytics on every result. (Also accepts the base field name 'searchTerms'.)",
            "items": {
              "type": "string"
            }
          },
          "videoUrls": {
            "title": "🔗 Direct video URLs",
            "type": "array",
            "description": "Direct YouTube video/Shorts URLs to analyze without a keyword search — ideal for monitoring specific uploads over time. (Also accepts the base field name 'startUrls'.)",
            "items": {
              "type": "string"
            }
          },
          "maxVideoResults": {
            "title": "🎞️ Max long-form videos per query",
            "minimum": 0,
            "maximum": 9999,
            "type": "integer",
            "description": "How many regular (non-Shorts, non-live) videos to analyze per search query. 0 = skip long-form videos. (Also accepts 'maxVideos'.)"
          },
          "maxShortResults": {
            "title": "📱 Max Shorts per query",
            "minimum": 0,
            "maximum": 9999,
            "type": "integer",
            "description": "How many YouTube Shorts to analyze per query. 0 = skip Shorts. (Also accepts 'maxShorts'.)"
          },
          "maxLiveResults": {
            "title": "📡 Max live streams per query",
            "minimum": 0,
            "maximum": 9999,
            "type": "integer",
            "description": "How many live/upcoming streams to analyze per query. 0 = skip streams. (Also accepts 'maxStreams'.)"
          },
          "fetchHeatmapChapters": {
            "title": "🔥 Fetch most-replayed heatmap & chapter markers",
            "type": "boolean",
            "description": "Extract YouTube's own \"most replayed\" retention heatmap curve (the scrubber-bar graph showing which seconds viewers rewatch most) plus creator-defined chapter markers, and derive the single most-replayed timestamp/intensity per video. This reads data already present in the same page fetch the actor performs for every video — no extra requests. No competitor scraper exposes this curve.",
            "default": true
          },
          "fetchComments": {
            "title": "💬 Fetch comments & replies",
            "type": "boolean",
            "description": "Fetch full comment threads (author, avatar, text, likes, pinned/hearted-by-creator flags) with replies threaded via the comment they reply to. Costs about 1 extra request per video (plus 1 more per additional comment page). Off by default to keep runs fast.",
            "default": false
          },
          "maxCommentsPerVideo": {
            "title": "🔢 Max top-level comments per video",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Cap on top-level comments fetched per video (0 = fetch every page available, up to a 20-page safety limit). Replies do not count against this cap. Example: maxCommentsPerVideo=20 + maxRepliesPerComment=5 → up to 20 comments and up to 100 replies per video.",
            "default": 20
          },
          "maxRepliesPerComment": {
            "title": "↩️ Max replies per comment",
            "minimum": 0,
            "maximum": 200,
            "type": "integer",
            "description": "Cap on replies fetched per top-level comment. 0 = fetch top-level comments only, no replies.",
            "default": 5
          },
          "commentSortOrder": {
            "title": "🧮 Comment sort order",
            "enum": [
              "top",
              "newest"
            ],
            "type": "string",
            "description": "Fetch comments in YouTube's \"Top comments\" order (highest engagement first) or \"Newest first\".",
            "default": "top"
          },
          "computeEngagementAnalytics": {
            "title": "📈 Compute engagement rate, view velocity & percentile rank",
            "type": "boolean",
            "description": "Add derived, non-AI analytics to every video row: engagementRate ((likes+comments)/views), likeToViewRatio, commentToViewRatio, viewsPerDay (view velocity since publish), and viewsPercentileRank (each video's view-count rank, 0-100, within this run's result set). Pure computation — no extra requests.",
            "default": true
          },
          "downloadTranscripts": {
            "title": "📝 Download transcripts",
            "type": "boolean",
            "description": "Fetch video subtitles/transcripts when available. (Also accepts 'downloadSubtitles'.)"
          },
          "saveTranscriptsToKvs": {
            "title": "🗄️ Save transcripts to key-value store",
            "type": "boolean",
            "description": "Store every downloaded transcript in the default key-value store under its own key (e.g. \"transcript-VIDEO_ID\"). (Also accepts 'saveSubtitlesToKvs'.)"
          },
          "transcriptLanguage": {
            "title": "🌐 Transcript language",
            "enum": [
              "en",
              "es",
              "fr",
              "de",
              "pt",
              "it",
              "ru",
              "ja",
              "ko",
              "zh",
              "ar",
              "hi",
              "bn",
              "tr",
              "pl",
              "nl",
              "sv",
              "id",
              "th",
              "vi"
            ],
            "type": "string",
            "description": "Preferred transcript language; falls back to available tracks. (Also accepts 'subtitlesLanguage'.)"
          },
          "preferAutoGeneratedTranscript": {
            "title": "⚙️ Prefer auto-generated transcript",
            "type": "boolean",
            "description": "Prefer auto-generated captions over manually uploaded ones (wider coverage, less accuracy). (Also accepts 'preferAutoGenerated'.)"
          },
          "transcriptFormat": {
            "title": "📄 Transcript format",
            "enum": [
              "srt",
              "text",
              "timestamp"
            ],
            "type": "string",
            "description": "Output shape for transcripts: SRT, plain text, or timestamped JSON. (Also accepts 'subtitlesFormat'.)"
          },
          "resultsSortOrder": {
            "title": "🧮 Results sort order",
            "enum": [
              "",
              "relevance",
              "date",
              "viewCount",
              "rating"
            ],
            "type": "string",
            "description": "Sort search results by relevance, upload date, view count, or rating. (Also accepts 'sortingOrder'.)"
          },
          "uploadDateFilter": {
            "title": "🕒 Upload date filter",
            "enum": [
              "",
              "hour",
              "today",
              "week",
              "month",
              "year"
            ],
            "type": "string",
            "description": "YouTube's built-in upload-date filter. (Also accepts 'dateFilter'.)"
          },
          "contentTypeFilter": {
            "title": "📂 Content type filter",
            "enum": [
              "",
              "video",
              "channel",
              "playlist",
              "movie"
            ],
            "type": "string",
            "description": "Keep only standard videos (excludes Shorts). Channel/playlist/movie values are accepted for compatibility. (Also accepts 'videoTypeFilter'.)"
          },
          "durationFilter": {
            "title": "⏱️ Duration filter",
            "enum": [
              "",
              "short",
              "medium",
              "long"
            ],
            "type": "string",
            "description": "YouTube's length presets. (Also accepts 'lengthFilter'.)"
          },
          "publishedAfterDate": {
            "title": "📆 Published after (date)",
            "pattern": "^(\\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$|^$",
            "type": "string",
            "description": "Only include videos published after this date (YYYY-MM-DD). (Also accepts 'publishedAfter'.)"
          },
          "finalSortField": {
            "title": "📊 Final sort field",
            "enum": [
              "",
              "date",
              "viewCount",
              "likes"
            ],
            "type": "string",
            "description": "Sort the final dataset by date, view count, or likes after scraping. (Also accepts 'sortBy'.)"
          },
          "filterHD": {
            "title": "📺 HD only",
            "type": "boolean",
            "description": "Only include HD (720p+) videos. (Also accepts 'isHD'.)"
          },
          "filter4K": {
            "title": "🖥️ 4K only",
            "type": "boolean",
            "description": "Only include videos with a 2160p (4K) stream. (Also accepts 'is4K'.)"
          },
          "filterHDR": {
            "title": "🌈 HDR only",
            "type": "boolean",
            "description": "Only include High Dynamic Range videos. (Also accepts 'isHDR'.)"
          },
          "filterLive": {
            "title": "📺 Live only",
            "type": "boolean",
            "description": "Only include live/live-style content. (Also accepts 'isLive'.)"
          },
          "filter360": {
            "title": "🌐 360° video only",
            "type": "boolean",
            "description": "Only include immersive 360°/spherical videos. (Also accepts 'is360'.)"
          },
          "filter3D": {
            "title": "🕶️ 3D only",
            "type": "boolean",
            "description": "Only include stereoscopic 3D videos. (Also accepts 'is3D'.)"
          },
          "filterVR180": {
            "title": "🥽 VR180 only",
            "type": "boolean",
            "description": "Only include VR180 videos. (Also accepts 'isVR180'.)"
          },
          "filterClosedCaptions": {
            "title": "📝 Has closed captions",
            "type": "boolean",
            "description": "Only include videos with at least one non-auto-generated caption track. (Also accepts 'hasCC'.)"
          },
          "filterLocationData": {
            "title": "📍 Has location data",
            "type": "boolean",
            "description": "Only include videos with explicit location metadata. (Also accepts 'hasLocation'.)"
          },
          "filterCreativeCommons": {
            "title": "⚖️ Creative Commons only",
            "type": "boolean",
            "description": "Only include Creative Commons licensed videos. (Also accepts 'isCreativeCommons'.)"
          },
          "filterPurchased": {
            "title": "💳 Purchased content only",
            "type": "boolean",
            "description": "Best-effort filter for purchased/paid content; low coverage by YouTube's own design. (Also accepts 'isPurchased'.)"
          },
          "proxySettings": {
            "title": "🛡️ Proxy configuration & anti-blocking",
            "type": "object",
            "description": "Starting proxy setup. Defaults to no proxy; the actor automatically escalates to Apify datacenter then residential proxy on blocks, locking onto residential once it works. (Also accepts 'proxyConfiguration'.)"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}