# YouTube Search Scraper (Legacy) (`mina_safwat/youtube-search`) Actor

The fastest and simplest YouTube Search Actor. Extract YouTube search results effortlessly. just provide a list of search queries, and it will return structured data about videos

- **URL**: https://apify.com/mina_safwat/youtube-search.md
- **Developed by:** [Mina](https://apify.com/mina_safwat) (community)
- **Categories:** Developer tools, Social media, Automation
- **Stats:** 4 total users, 0 monthly users, 100.0% 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/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### YouTube Search Scraper

A powerful Apify Actor for scraping YouTube search results using the YouTube internal API. This Actor allows you to search YouTube with multiple queries and extract detailed video information without getting blocked, thanks to Apify proxy integration.

### Features

- Search YouTube with multiple queries
- Extract detailed video information including:
  - Video ID, title, and URL
  - Video description snippet
  - Channel name and URL
  - View count and publish date
  - Video duration
  - Thumbnail URL
- Configurable maximum results per query
- Built-in Apify proxy support to avoid rate limiting
- Fast and efficient using YouTube's internal API

### Input

```json
{
  "queries": [
    "apify tutorial",
    "web scraping python",
    "youtube api tutorial"
  ],
  "max_results": 20,
  "use_proxy": true
}
```

#### Input Parameters

- **queries** (required): Array of search queries to scrape
- **max_results** (optional): Maximum number of results per query (1-100, default: 20)
- **use_proxy** (optional): Use Apify proxy to avoid blocking (default: true)

### Output

Each video result contains:

```json
{
  "query": "apify tutorial",
  "video_id": "dQw4w9WgXcQ",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "title": "Complete Apify Tutorial",
  "description": "Learn how to use Apify...",
  "view_count": 1234567,
  "length_text": "15 minutes, 30 seconds",
  "length_in_minutes": 15.5,
  "thumbnail_url": "https://i.ytimg.com/vi/...",
  "channel_name": "Tech Channel",
  "channel_url": "https://www.youtube.com/channel/...",
  "published_time": "2025-10-16T12:34:56.789012"
}
```

#### Output Fields

- **query**: The search query used
- **video_id**: YouTube video ID
- **url**: Full YouTube video URL
- **title**: Video title
- **description**: Video description snippet
- **view_count**: Numeric view count (parsed from text like "1,234,567 views" or "1.2M views")
- **length_text**: Video duration in readable format (e.g., "15 minutes, 30 seconds")
- **length_in_minutes**: Video duration in minutes as a float (e.g., 15.5)
- **thumbnail_url**: URL to video thumbnail image
- **channel_name**: Channel/creator name
- **channel_url**: URL to the channel
- **published_time**: ISO 8601 formatted approximate publish date (parsed from text like "2 weeks ago")

### SEO Keywords

youtube search scraper, scrape youtube search results, youtube video data api, youtube keyword research, youtube seo research, video metadata extractor, youtube channel discovery, youtube content research, youtube search results api

# Actor input Schema

## `queries` (type: `array`):

Array of YouTube search queries to scrape

## `max_results` (type: `integer`):

Maximum number of video results to return for each query

## `use_proxy` (type: `boolean`):

Use Apify proxy to avoid getting blocked

## Actor input object example

```json
{
  "queries": [
    "apify tutorial",
    "web scraping python"
  ],
  "max_results": 20,
  "use_proxy": true
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# 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 = {
    "queries": [
        "apify tutorial",
        "web scraping python"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("mina_safwat/youtube-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 = { "queries": [
        "apify tutorial",
        "web scraping python",
    ] }

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

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

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

```

## CLI example

```bash
echo '{
  "queries": [
    "apify tutorial",
    "web scraping python"
  ]
}' |
apify call mina_safwat/youtube-search --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,mina_safwat/youtube-search"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/WhAjgRbDSrZMcdLXD/builds/fj5fQDZt8etNRLSmB/openapi.json
