{
  "openapi": "3.0.1",
  "info": {
    "title": "YouTube Comment Sentiment Scraper",
    "description": "Analyze public YouTube comments with bounded sentiment, topic and spam heuristics using ordinary public browsing or an opt-in official YouTube Data API route.",
    "version": "1.2",
    "x-build-id": "e0HXdu5gsCCL4e3sZ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/googleapi~youtube-comment-sentiment-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-googleapi-youtube-comment-sentiment-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/googleapi~youtube-comment-sentiment-scraper/runs": {
      "post": {
        "operationId": "runs-sync-googleapi-youtube-comment-sentiment-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/googleapi~youtube-comment-sentiment-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-googleapi-youtube-comment-sentiment-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": {
          "videoUrls": {
            "title": "Video URLs",
            "maxItems": 100,
            "type": "array",
            "description": "HTTPS YouTube watch, Shorts, live, embed, youtu.be URLs, or 11-character video IDs. This is the primary source input.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 300
            }
          },
          "startUrls": {
            "title": "Start URLs (alias)",
            "maxItems": 100,
            "type": "array",
            "description": "Compatibility alias for videoUrls. Each item must be an object with a YouTube video URL.",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "title": "YouTube video URL",
                  "description": "HTTPS YouTube video URL or 11-character video ID.",
                  "type": "string",
                  "maxLength": 300
                }
              },
              "required": [
                "url"
              ],
              "additionalProperties": false
            }
          },
          "sourceUrls": {
            "title": "Source URLs (alias)",
            "maxItems": 100,
            "type": "array",
            "description": "Compatibility alias for videoUrls.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 300
            }
          },
          "urls": {
            "title": "URLs (legacy alias)",
            "maxItems": 100,
            "type": "array",
            "description": "Legacy compatibility alias for videoUrls.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 300
            }
          },
          "videoIds": {
            "title": "Video IDs",
            "maxItems": 100,
            "type": "array",
            "description": "11-character YouTube video IDs.",
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{11}$"
            }
          },
          "queries": {
            "title": "Search queries",
            "maxItems": 20,
            "type": "array",
            "description": "Public YouTube search terms used to discover video cards before comments are requested.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          "query": {
            "title": "Search query (alias)",
            "maxLength": 200,
            "type": "string",
            "description": "One compatibility search query; equivalent to a one-item queries array."
          },
          "searchQuery": {
            "title": "Search query (legacy alias)",
            "maxLength": 200,
            "type": "string",
            "description": "Legacy alias for query."
          },
          "searchUrls": {
            "title": "YouTube search URLs",
            "maxItems": 20,
            "type": "array",
            "description": "HTTPS /results URLs containing search_query. Query parameters are preserved while observed next links are followed.",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "title": "YouTube search URL",
                  "description": "HTTPS YouTube /results URL containing search_query.",
                  "type": "string",
                  "maxLength": 1000
                }
              },
              "required": [
                "url"
              ],
              "additionalProperties": false
            }
          },
          "maxItems": {
            "title": "Maximum comment records",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Global maximum number of normal comment records emitted across all videos and sources.",
            "default": 100
          },
          "maxCommentsPerVideo": {
            "title": "Maximum comments per video",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Per-video collection cap before the global maxItems limit is applied.",
            "default": 100
          },
          "maxVideos": {
            "title": "Maximum videos",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Maximum explicit or search-discovered videos to inspect.",
            "default": 25
          },
          "maxPages": {
            "title": "Maximum search pages",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Maximum observed search pages per query or search URL. The Actor never calls undocumented continuation endpoints.",
            "default": 1
          },
          "startPage": {
            "title": "Starting search page",
            "minimum": 1,
            "maximum": 1,
            "type": "integer",
            "description": "Compatibility alias for page. YouTube search exposes cursor-based Next links, not a stable numeric page offset; only the initial page (1) is supported.",
            "default": 1
          },
          "deduplicate": {
            "title": "Deduplicate comments and sources",
            "type": "boolean",
            "description": "Remove duplicate video sources and comment IDs across pages and queries.",
            "default": true
          },
          "sortComments": {
            "title": "Comment order",
            "enum": [
              "top",
              "new"
            ],
            "type": "string",
            "description": "Keep YouTube source order (top) or order comments by the relative age text when YouTube exposes it (new). No unavailable date is invented.",
            "default": "top"
          },
          "sortBy": {
            "title": "Sort alias",
            "enum": [
              "top",
              "new"
            ],
            "type": "string",
            "description": "Compatibility alias for sortComments; allowed values are top and new."
          },
          "includeReplies": {
            "title": "Include embedded replies",
            "type": "boolean",
            "description": "Include replies only when they are already rendered in the public page or present in embedded data; no continuation API is called.",
            "default": false
          },
          "includeVideoMetadata": {
            "title": "Include video metadata",
            "type": "boolean",
            "description": "Include public title, description, channel, publication, duration, view, live, and thumbnail fields from the watch page.",
            "default": true
          },
          "requestDelayMs": {
            "title": "Request delay (ms)",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Delay between ordinary source requests; 0 is allowed for local fixtures.",
            "default": 250
          },
          "maxConcurrency": {
            "title": "Maximum concurrency",
            "minimum": 1,
            "maximum": 4,
            "type": "integer",
            "description": "Bounded browser-page concurrency. The default is sequential to preserve source order and limit public traffic.",
            "default": 1
          },
          "maxRequestRetries": {
            "title": "Maximum retries",
            "minimum": 0,
            "maximum": 3,
            "type": "integer",
            "description": "Bounded retries for transient public HTTP failures.",
            "default": 1
          },
          "requestTimeoutSecs": {
            "title": "Request timeout (seconds)",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "Timeout for each public HTML request.",
            "default": 30
          },
          "maxResponseBytes": {
            "title": "Maximum response characters",
            "minimum": 100000,
            "maximum": 5000000,
            "type": "integer",
            "description": "Bound for HTML/fixture text retained for parsing.",
            "default": 2000000
          },
          "userAgent": {
            "title": "User agent",
            "maxLength": 300,
            "type": "string",
            "description": "Optional ordinary user-agent string for direct HTTP discovery; it is not rotated or used for access-control evasion. Browser rendering uses its normal browser user agent."
          },
          "locale": {
            "title": "Locale",
            "pattern": "^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})?$",
            "type": "string",
            "description": "BCP-47-like locale sent in Accept-Language and used for generated search URLs.",
            "default": "en-US"
          },
          "proxyConfiguration": {
            "title": "Apify Proxy configuration",
            "type": "object",
            "description": "Optional Apify Proxy configuration wired into direct HTTP discovery and ordinary browser requests. It does not bypass CAPTCHA or access controls; proxy credentials are never logged."
          },
          "page": {
            "title": "Page",
            "minimum": 1,
            "maximum": 1,
            "type": "integer",
            "description": "Starting page for video search discovery. YouTube exposes cursor-based Next links rather than a stable numeric offset, so only page 1 is supported.",
            "default": 1
          },
          "useYouTubeDataApi": {
            "title": "Use official YouTube Data API",
            "type": "boolean",
            "description": "Select the official API for public comments and optional video metadata, including documented search discovery. Requires the secret youtubeApiKey. Disabled by default.",
            "default": false
          },
          "youtubeApiKey": {
            "title": "YouTube Data API key",
            "type": "string",
            "description": "Configure an already authorized YouTube Data API v3 key securely in Apify. Never include it in source files or example input. Ignored unless useYouTubeDataApi is enabled. API requests go directly to Google; proxyConfiguration applies to browser requests."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}