# YouTube tools

Six tools for channels, videos, comments and captions implemented; live verification pending.

## Get a YouTube channel

Tool: `youtube_get_channel`

Public channel details and published subscriber/video/view counts.

Endpoint: `POST /api/social/tools/youtube_get_channel`

Cost: 5 product credits per call/page. No fixed number of rows per page. Use dry_run for the selected options' quote.

### Input JSON schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "handle": {
      "type": "string",
      "minLength": 1,
      "maxLength": 101,
      "pattern": "^@?[\\p{L}\\p{N}_.·-]+$"
    },
    "dry_run": {
      "default": false,
      "type": "boolean"
    },
    "max_credits": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "idempotency_key": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{8,100}$"
    }
  },
  "required": [
    "handle"
  ],
  "additionalProperties": false
}
```

## Get YouTube channel videos

Tool: `youtube_get_videos`

One page of a channel's videos, latest or popular. No per-video enrichment.

Endpoint: `POST /api/social/tools/youtube_get_videos`

Cost: 5 product credits per call/page. No fixed number of rows per page. Use dry_run for the selected options' quote.

### Input JSON schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "handle": {
      "type": "string",
      "minLength": 1,
      "maxLength": 101,
      "pattern": "^@?[\\p{L}\\p{N}_.·-]+$"
    },
    "sort": {
      "default": "latest",
      "type": "string",
      "enum": [
        "latest",
        "popular"
      ]
    },
    "cursor": {
      "type": "string",
      "minLength": 1,
      "maxLength": 16384
    },
    "dry_run": {
      "default": false,
      "type": "boolean"
    },
    "max_credits": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "idempotency_key": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{8,100}$"
    }
  },
  "required": [
    "handle"
  ],
  "additionalProperties": false
}
```

## Get a YouTube video

Tool: `youtube_get_video`

Read a video or Short, its description and available engagement metrics.

Endpoint: `POST /api/social/tools/youtube_get_video`

Cost: 5 product credits per call/page. No fixed number of rows per page. Use dry_run for the selected options' quote.

### Input JSON schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "maxLength": 2048,
      "format": "uri"
    },
    "dry_run": {
      "default": false,
      "type": "boolean"
    },
    "max_credits": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "idempotency_key": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{8,100}$"
    }
  },
  "required": [
    "url"
  ],
  "additionalProperties": false
}
```

## Get YouTube comments

Tool: `youtube_get_comments`

One page of top comments. Reply pagination requires separate work and is not performed automatically.

Endpoint: `POST /api/social/tools/youtube_get_comments`

Cost: 5 product credits per call/page. No fixed number of rows per page. Use dry_run for the selected options' quote.

### Input JSON schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "maxLength": 2048,
      "format": "uri"
    },
    "cursor": {
      "type": "string",
      "minLength": 1,
      "maxLength": 16384
    },
    "dry_run": {
      "default": false,
      "type": "boolean"
    },
    "max_credits": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "idempotency_key": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{8,100}$"
    }
  },
  "required": [
    "url"
  ],
  "additionalProperties": false
}
```

## Search YouTube videos

Tool: `youtube_search_videos`

One page of native video search. latest uses relevance because newest-first search is unavailable.

Endpoint: `POST /api/social/tools/youtube_search_videos`

Cost: 5 product credits per call/page. No fixed number of rows per page. Use dry_run for the selected options' quote.

### Input JSON schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "since": {
      "default": "month",
      "type": "string",
      "enum": [
        "day",
        "week",
        "month",
        "year",
        "all"
      ]
    },
    "sort": {
      "default": "relevance",
      "type": "string",
      "enum": [
        "relevance",
        "latest",
        "popular"
      ]
    },
    "cursor": {
      "type": "string",
      "minLength": 1,
      "maxLength": 16384
    },
    "dry_run": {
      "default": false,
      "type": "boolean"
    },
    "max_credits": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "idempotency_key": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{8,100}$"
    }
  },
  "required": [
    "query"
  ],
  "additionalProperties": false
}
```

## Get a YouTube transcript

Tool: `youtube_get_transcript`

Public captions, optionally requesting a language. No AI transcription or extra lookup.

Endpoint: `POST /api/social/tools/youtube_get_transcript`

Cost: 5 product credits per call/page. No fixed number of rows per page. Use dry_run for the selected options' quote.

### Input JSON schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "maxLength": 2048,
      "format": "uri"
    },
    "language": {
      "type": "string",
      "pattern": "^[a-zA-Z]{2,3}(?:-[a-zA-Z0-9]{2,8})?$"
    },
    "dry_run": {
      "default": false,
      "type": "boolean"
    },
    "max_credits": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "idempotency_key": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{8,100}$"
    }
  },
  "required": [
    "url"
  ],
  "additionalProperties": false
}
```
