# YouTube Channel Search Scraper (`aicasper/youtube-channel-search`) Actor

Find YouTube channels and their video from one or more search terms.
Complete with channel details such as channel name, id, keywords, tags, and many more data points. Try it now.

- **URL**: https://apify.com/aicasper/youtube-channel-search.md
- **Developed by:** [Casper](https://apify.com/aicasper) (community)
- **Categories:** Social media, Lead generation, Developer tools
- **Stats:** 6 total users, 3 monthly users, 83.6% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## YouTube Channel Search

This Apify Actor finds YouTube channels from one or more search terms.

It is designed for batch use: add search terms in the Apify UI, paste one term per line, or upload CSV/TXT files. The Actor processes multiple terms concurrently and writes one dataset item per discovered channel as soon as each page is processed.

### Input

- `searchTerms`: list of terms in the Apify UI.
- `searchTermsText`: optional newline-separated or CSV-style text.
- `searchTermsFiles`: optional uploaded CSV/TXT files. CSV files can use a `searchTerm`, `term`, `query`, `keyword`, or `keywords` column; otherwise the first column is used.
- `maxChannelsPerSearchTerm`: `0` means first page only. Any positive value follows continuation pages until that many unique channels are found per term.
- `maxConcurrency`: number of search terms processed at the same time. Default is `5`.
- `useChannelSearchFilter`: optional second pass. The Actor always discovers uploader channels from video search first; when this is enabled, it also runs YouTube's channel-only search as an addition.
- `dedupeAcrossSearchTerms`: optionally emit the same channel only once across the full run.

### Output

Each dataset item includes normalized fields plus the raw source object from the result that exposed the channel:

- Search metadata: `searchTerm`, `rank`
- Discovery metadata: `discoverySource`, and for video discovery, `sourceVideoId`, `sourceVideoTitle`, `sourceVideoUrl`, `sourceVideoPublishedTimeText`, `sourceVideoViewCountText`
- Channel fields: `channelId`, `title`, `url`, `handleText`, `subscriberCountText`, `subscriberCount`, `subscriberCountIsExact`, `videoCountText`, `videoCount`, `description`, `thumbnailUrl`, `badges`
- Channel details are always fetched and added at the top level when available: `descriptionPreview`, `microformatDescription`, `keywords`, `tags`, `externalId`, `channelUrl`, `canonicalUrl`, `vanityChannelUrl`, `ownerUrls`, `rssUrl`, `avatarUrl`, `avatarImages`, `isFamilySafe`, `isUnlisted`, `isNoindex`, `availableCountryCodes`, `linkAlternates`, and compact `tabs`.
- Raw source object: `rawVideoResult` for video discovery, or `rawSearchResult` for the optional channel-filter addition.

The raw source result is intentionally preserved because YouTube responses can expose fields that vary by query, locale, and UI changes.

### Development Notes

This Actor calls YouTube's internal search and channel metadata endpoints directly with a web client context.

Run locally after installing dependencies:

```bash
python -m venv .venv
.venv/bin/python -m pip install -r requirements.txt
.venv/bin/python -m src
````

For normal Apify local runs, use the Apify CLI:

```bash
apify run
```

# Actor input Schema

## `searchTerms` (type: `array`):

Search terms to run against YouTube. Each term is processed independently.

## `searchTermsText` (type: `string`):

Optional. Paste one search term per line. CSV-style commas are also accepted.

## `searchTermsFiles` (type: `array`):

Optional. Upload one or more CSV or TXT files containing search terms. For CSV, the Actor uses a column named searchTerm, term, query, keyword, or the first column.

## `maxChannelsPerSearchTerm` (type: `integer`):

Optional. If empty or 0, the Actor returns channels from the first result page only. If set, it follows continuation pages until this many unique channels are found per term or no more results are available.

## `maxConcurrency` (type: `integer`):

Maximum number of search terms processed at the same time. Default 5 is fast without being noisy.

## `useChannelSearchFilter` (type: `boolean`):

Optional second pass. The Actor always discovers channels from video results first; when this is enabled, it also tries YouTube's channel-only search after video discovery stops or reaches the first page.

## `dedupeAcrossSearchTerms` (type: `boolean`):

If enabled, the same channel is emitted only once across the whole run. If disabled, the same channel can appear for multiple search terms.

## Actor input object example

```json
{
  "searchTerms": [
    "coffee roasting",
    "indie game dev"
  ],
  "maxChannelsPerSearchTerm": 0,
  "maxConcurrency": 5,
  "useChannelSearchFilter": false,
  "dedupeAcrossSearchTerms": false
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchTerms": [
        "coffee roasting",
        "indie game dev"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("aicasper/youtube-channel-search").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "searchTerms": [
        "coffee roasting",
        "indie game dev",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("aicasper/youtube-channel-search").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchTerms": [
    "coffee roasting",
    "indie game dev"
  ]
}' |
apify call aicasper/youtube-channel-search --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=aicasper/youtube-channel-search",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "YouTube Channel Search Scraper",
        "description": "Find YouTube channels and their video from one or more search terms.\nComplete with channel details such as channel name, id, keywords, tags, and many more data points. Try it now.",
        "version": "0.1",
        "x-build-id": "3s6Yj9M1v9Txa4Edj"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/aicasper~youtube-channel-search/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-aicasper-youtube-channel-search",
                "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/aicasper~youtube-channel-search/runs": {
            "post": {
                "operationId": "runs-sync-aicasper-youtube-channel-search",
                "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/aicasper~youtube-channel-search/run-sync": {
            "post": {
                "operationId": "run-sync-aicasper-youtube-channel-search",
                "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": {
                    "searchTerms": {
                        "title": "Search terms",
                        "uniqueItems": true,
                        "type": "array",
                        "description": "Search terms to run against YouTube. Each term is processed independently.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "searchTermsText": {
                        "title": "Search terms as text",
                        "type": "string",
                        "description": "Optional. Paste one search term per line. CSV-style commas are also accepted."
                    },
                    "searchTermsFiles": {
                        "title": "Search terms files",
                        "type": "array",
                        "description": "Optional. Upload one or more CSV or TXT files containing search terms. For CSV, the Actor uses a column named searchTerm, term, query, keyword, or the first column.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxChannelsPerSearchTerm": {
                        "title": "Max channels per search term",
                        "minimum": 0,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Optional. If empty or 0, the Actor returns channels from the first result page only. If set, it follows continuation pages until this many unique channels are found per term or no more results are available.",
                        "default": 0
                    },
                    "maxConcurrency": {
                        "title": "Max concurrency",
                        "minimum": 1,
                        "maximum": 50,
                        "type": "integer",
                        "description": "Maximum number of search terms processed at the same time. Default 5 is fast without being noisy.",
                        "default": 5
                    },
                    "useChannelSearchFilter": {
                        "title": "Also use YouTube channel filter",
                        "type": "boolean",
                        "description": "Optional second pass. The Actor always discovers channels from video results first; when this is enabled, it also tries YouTube's channel-only search after video discovery stops or reaches the first page.",
                        "default": false
                    },
                    "dedupeAcrossSearchTerms": {
                        "title": "Dedupe across search terms",
                        "type": "boolean",
                        "description": "If enabled, the same channel is emitted only once across the whole run. If disabled, the same channel can appear for multiple search terms.",
                        "default": 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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
