{
  "openapi": "3.0.1",
  "info": {
    "title": "YouTube Scraper: Attention Queue, Breakout Detection",
    "description": "Scrapes YouTube channels, videos, playlists and search. Breakout detection, momentum scoring, attention routing, watchlist deltas. Drop-in from streamers/youtube-scraper. 60% cheaper. $2/1k records.",
    "version": "1.0",
    "x-build-id": "7KpiN5ydtD7en3Qcz"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ryanclinton~youtube-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ryanclinton-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/ryanclinton~youtube-scraper/runs": {
      "post": {
        "operationId": "runs-sync-ryanclinton-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/ryanclinton~youtube-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-ryanclinton-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",
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "channels",
              "videos",
              "playlists",
              "search",
              "shorts"
            ],
            "type": "string",
            "description": "Entry point for the run. Channels takes handles or IDs. Videos takes URLs or IDs. Playlists takes playlist URLs. Search takes a query string. Shorts takes handles and returns recent shorts.",
            "default": "search"
          },
          "channels": {
            "title": "Channels",
            "uniqueItems": true,
            "type": "array",
            "description": "Channel handles (@mkbhd), channel IDs (UCBJycsmduvYEL83R_U4JriQ), or full channel URLs. Used when mode is 'channels' or 'shorts'.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "maxRecentVideosPerChannel": {
            "title": "Max recent videos per channel",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Cap on recent uploads scraped per channel in channels mode. Higher values produce stronger signal detection but slower runs.",
            "default": 50
          },
          "includeShortsInVideoList": {
            "title": "Include shorts in channel video list",
            "type": "boolean",
            "description": "Pull shorts alongside long-form uploads when fetching a channel's recent videos.",
            "default": true
          },
          "includeTranscripts": {
            "title": "Include transcripts",
            "type": "boolean",
            "description": "Fetch transcripts for sampled videos. Slows the run but enables richer topic detection and comment-theme grounding.",
            "default": false
          },
          "videos": {
            "title": "Videos",
            "uniqueItems": true,
            "type": "array",
            "description": "Video URLs (https://www.youtube.com/watch?v=...) or bare 11-character video IDs. Used when mode is 'videos'.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "enrichChannel": {
            "title": "Enrich parent channel for each video",
            "type": "boolean",
            "description": "In videos mode, additionally fetch the parent channel of each video so per-video signals (breakout_video, vsChannelBaseline) have a real channel baseline to score against.",
            "default": true
          },
          "includeTranscript": {
            "title": "Include transcript per video",
            "type": "boolean",
            "description": "Fetch the transcript for each video (videos mode).",
            "default": false
          },
          "includeCommentsSample": {
            "title": "Include comments sample",
            "type": "boolean",
            "description": "Sample top-level comments for each video. Required for commentSynthesis themes and audience-expansion detection.",
            "default": false
          },
          "commentsSamplePerVideo": {
            "title": "Comments sample size per video",
            "minimum": 0,
            "maximum": 500,
            "type": "integer",
            "description": "Number of top-level comments to sample per video. 30 enables commentSynthesis themes. 0 disables comment sampling.",
            "default": 0
          },
          "playlists": {
            "title": "Playlists",
            "uniqueItems": true,
            "type": "array",
            "description": "Playlist URLs (https://www.youtube.com/playlist?list=...). Used when mode is 'playlists'.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "maxVideosPerPlaylist": {
            "title": "Max videos per playlist",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Cap on videos pulled per playlist.",
            "default": 100
          },
          "searchQuery": {
            "title": "Search query",
            "type": "string",
            "description": "Search query string. Used when mode is 'search'.",
            "default": ""
          },
          "videoType": {
            "title": "Video type filter (search)",
            "enum": [
              "any",
              "video",
              "short",
              "live",
              "playlist",
              "channel"
            ],
            "type": "string",
            "description": "Restrict search to a single result type.",
            "default": "any"
          },
          "country": {
            "title": "Country (search)",
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country code for the search geo, e.g. US, GB, DE.",
            "default": "US"
          },
          "language": {
            "title": "Language (search)",
            "type": "string",
            "description": "ISO 639-1 language code for the search, e.g. en, es, ja.",
            "default": "en"
          },
          "dateRange": {
            "title": "Date range (search)",
            "enum": [
              "any",
              "this_hour",
              "today",
              "this_week",
              "this_month",
              "this_year"
            ],
            "type": "string",
            "description": "Restrict search to recent uploads.",
            "default": "any"
          },
          "uploadOrder": {
            "title": "Upload order (search)",
            "enum": [
              "relevance",
              "date",
              "viewCount",
              "rating"
            ],
            "type": "string",
            "description": "YouTube's native ordering before reranking. 'relevance' is the default YouTube ordering; 'date' sorts by upload date.",
            "default": "relevance"
          },
          "rankBy": {
            "title": "Rank by (search reranking)",
            "enum": [
              "relevance",
              "breakoutPotential",
              "momentum",
              "recency",
              "engagement"
            ],
            "type": "string",
            "description": "Reranking axis applied on top of YouTube's native ordering. 'breakoutPotential' surfaces channels that are accelerating right now. 'relevance' keeps YouTube's order.",
            "default": "breakoutPotential"
          },
          "maxResults": {
            "title": "Max results (search)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Cap on search results emitted, regardless of YouTube's native page size.",
            "default": 50
          },
          "maxShortsPerChannel": {
            "title": "Max shorts per channel (shorts mode)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Cap on shorts pulled per channel.",
            "default": 50
          },
          "oldestPostDate": {
            "title": "Oldest post date (shorts mode)",
            "type": "string",
            "description": "Drop shorts published before this date (ISO 8601 yyyy-mm-dd). Leave blank for no lower bound.",
            "default": ""
          },
          "outputProfile": {
            "title": "Output profile",
            "enum": [
              "substrate",
              "signals",
              "research",
              "llm",
              "minimal",
              "compat"
            ],
            "type": "string",
            "description": "Field shape. 'signals' is the default and includes the signal layer on every record. 'compat' returns the exact streamers/youtube-scraper field set for migration verification. 'substrate' returns substrate + raw fields only. 'research' adds evidence + provenance. 'llm' is a compact NL summary. 'minimal' is IDs and URLs only.",
            "default": "signals"
          },
          "watchlistName": {
            "title": "Watchlist name (enables delta intelligence)",
            "type": "string",
            "description": "When set, the run is scoped to a persistent watchlist. The actor reads the prior baseline from a named KV store, computes deltas, and writes the new baseline back. Use the same name for daily scheduled runs to get a monitoring feed.",
            "default": ""
          },
          "enableCommentThemes": {
            "title": "Enable LLM comment-theme synthesis",
            "type": "boolean",
            "description": "When enabled and a groq API key is supplied, comment samples are passed through Llama 3.1 8B for theme naming. When disabled (or no key supplied), falls back to lexicon-only theme detection. Both paths produce commentSynthesis.themes; the LLM path produces sharper labels.",
            "default": true
          },
          "groqApiKey": {
            "title": "Groq API key (optional)",
            "type": "string",
            "description": "Optional groq API key for comment-theme naming. If absent, comment theme labels fall back to deterministic lexicon clustering. Stored as a secret."
          },
          "rateLimitPerSecond": {
            "title": "Rate limit per second",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Upper bound on requests per second across all YouTube calls. Default is conservative to avoid bot-blocks.",
            "default": 2
          },
          "circuitBreakerThreshold": {
            "title": "Circuit breaker threshold",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Number of consecutive bot-blocked responses before the run halts. Lower values are safer for paid accounts.",
            "default": 3
          },
          "runtimeBudgetSeconds": {
            "title": "Runtime budget (seconds)",
            "minimum": 60,
            "maximum": 21600,
            "type": "integer",
            "description": "Soft runtime cap. The actor exits cleanly with partial results and truncated=true when this is exceeded, instead of getting hard-killed by Apify's timeout mid-emit. Auto-clamped against APIFY_TIMEOUT_AT minus a maxResults-scaled emit reserve so the dataset always finishes pushing. Default 3000 (50min).",
            "default": 3000
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Apify proxy configuration. Defaults to RESIDENTIAL with US rotation, which is what YouTube tolerates best.",
            "default": {
              "useApifyProxy": true,
              "apifyProxyGroups": [
                "RESIDENTIAL"
              ],
              "apifyProxyCountry": "US"
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}