# YouTube Search API (`automly/youtube-search-api`) Actor

YouTube Search API: search YouTube by keyword and get ranked videos, channels or playlists with title, link, views, length, publish time, channel and thumbnail, hundreds per search. Filters for date, length and sort. No login or API key.

- **URL**: https://apify.com/automly/youtube-search-api.md
- **Developed by:** [Automly](https://apify.com/automly) (community)
- **Categories:** Videos, Social media
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.35 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

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

### What is YouTube Search API?

**YouTube Search API** lets you **search YouTube by keyword and get the results as data**, ranked exactly as YouTube shows them: each video's **title, link, views, length, publish time, channel and thumbnail**, plus channel and playlist results if you want them. Type your search terms, click **Start**, and download hundreds of results per search as Excel, CSV or JSON, or call it from your own code.

- 🔎 **Many searches at once:** one search term per line, every result tagged with its search term and rank
- 🎚️ **YouTube's own filters:** sort by relevance, upload date, view count or rating; upload date and video length filters
- 🎬 **Videos, channels and playlists:** keep the result types you need
- 🌍 **Any country:** results for the country you choose
- 🔓 **No login:** no YouTube account, cookies or API key, and no daily quota
- 💸 **Free to try:** every Apify account gets $5 of free usage each month

### What can YouTube Search API do?

- **Get YouTube search results in bulk** for a list of keywords, one row per result
- **Track YouTube rankings** for your keywords with a daily schedule
- **Find the top videos for a topic** sorted by views, upload date or rating
- **Find channels and playlists** about any topic
- Export to Excel, CSV, JSON, HTML or XML, or send the data to Google Sheets, Make, Zapier and more

### What data can you extract from YouTube search?

| | | |
|---|---|---|
| 🔢 Rank in the results | 🎬 Title | 🔗 Link |
| 👁️ Views | ⏱️ Length | 📅 Publish time |
| 📺 Channel name and link | 🖼️ Thumbnail | 📝 Description snippet |
| 📱 Short or live stream | 🏷️ Badges (New, 4K, CC, Verified) | 👥 Subscribers (channel results) |

### How to scrape YouTube search results

1. [Create a free Apify account](https://console.apify.com/sign-up).
2. Open **YouTube Search API**.
3. Type your search terms, one per line, and choose how many results to get for each.
4. Click **Start**, then download the results as Excel, CSV, JSON or HTML.

### How much does it cost to scrape YouTube search?

You pay only for the results you get:

| Apify plan | Price per 1,000 results |
|---|---|
| Free | $0.50 |
| Bronze | $0.45 |
| Silver | $0.40 |
| Gold, Platinum, Diamond | $0.35 |

Example on the Bronze plan: 10 searches of 100 results each cost $0.45. Each run also costs $0.001 to start.

A search YouTube has no results for is not charged. Every Apify account gets **$5 of free usage each month**, and you can set a maximum cost per run.

### ⬇️ Input

| Setting | What it does |
|---|---|
| **Search terms** | What to search YouTube for, one search term per line |
| **Max results per search term** | 1 to 1,000 (YouTube itself stops some searches earlier) |
| **Result types** | `video`, `channel` and/or `playlist`; videos only by default |
| **Sort by** | Relevance, upload date, view count or rating |
| **Upload date** | Last hour, today, this week, this month or this year |
| **Video length** | Under 4 minutes, 4-20 minutes or over 20 minutes |
| **Country** | Two-letter country code of the results, e.g. `US`, `GB`, `DE` |
| **Language** | Two-letter language code, e.g. `en` |

The 100 most viewed videos over 20 minutes long for two searches:

```json
{
  "queries": ["web scraping tutorial", "python for beginners"],
  "maxResults": 100,
  "order": "viewCount",
  "videoDuration": "long",
  "regionCode": "US"
}
```

If you used another YouTube search API, your saved input works here too: `q`, `order`, `videoDuration`, `regionCode` and `relevanceLanguage` are understood.

### ⬆️ Output

Every result is one row:

```json
{
  "query": "web scraping tutorial",
  "rank": 2,
  "resultKind": "video",
  "itemId": "QhD015WUMxE",
  "videoId": "QhD015WUMxE",
  "channelId": "UCZDA1kA3y3EIg25BpcHSpwQ",
  "playlistId": null,
  "title": "Beginners Guide To Web Scraping with Python - All You Need To Know",
  "url": "https://www.youtube.com/watch?v=QhD015WUMxE",
  "channelName": "Tinkernut",
  "channelUrl": "https://www.youtube.com/@Tinkernut",
  "publishedText": "4y ago",
  "publishedAt": null,
  "duration": "7:36",
  "durationSeconds": 456,
  "viewCountText": "490,897 views",
  "viewCount": 490897,
  "descriptionSnippet": "The web is full of data. Lots and lots of data. Data prime for scraping. But manually going to a website and copying and pasting the ...",
  "thumbnailUrl": "https://i.ytimg.com/vi/QhD015WUMxE/hq720.jpg",
  "isShort": false,
  "isLive": false,
  "badges": ["Verified"],
  "subscriberCountText": null,
  "subscriberCount": null,
  "videoCount": null,
  "channelDescription": null,
  "channelThumbnailUrl": null,
  "fetchedAt": "2026-11-14T15:06:39Z"
}
```

The **Overview** tab shows the main columns; download the dataset for every field. Channel results carry the channel's subscribers and video count, playlist results their video count.

### How can I use YouTube search data?

- **SEO and rank tracking:** see where your videos rank for your keywords, and who ranks above you
- **Content research:** find what performs for a topic: titles, lengths, views and upload times
- **Influencer discovery:** find the channels that appear for the keywords of your market
- **Trend monitoring:** run the same searches every day sorted by upload date and catch new videos
- **Apps and AI agents:** give your app or agent YouTube search results without a quota

### Scrape more YouTube and social media data

| Actor | What it gets |
|---|---|
| [YouTube Scraper](https://apify.com/automly/youtube-scraper) | YouTube videos, Shorts and live streams with exact likes and comments from search, channels, playlists and links |
| [YouTube Video Details Scraper](https://apify.com/automly/youtube-video-details-scraper) | Full details of any YouTube video from its link or ID |
| [YouTube Channel Scraper - Search Channels by Keyword](https://apify.com/automly/youtube-channel-search-scraper) | YouTube channels by keyword: subscribers, video and view counts, country, links |
| [YouTube Transcript Scraper](https://apify.com/automly/youtube-transcript-scraper) | Transcripts and captions of YouTube videos and Shorts |

### ❓FAQ

#### How many results can I get for one search?

Ask for up to 1,000 per search term. YouTube itself ends most searches after a few hundred results; you then get every result it shows.

#### Do I need a YouTube API key?

No. There is no key to create, no quota to watch and no Google Cloud project to set up.

#### Does it get exact likes and comment counts?

Search results show views, length and publish time. For exact likes, comments and publish dates of each video, use [YouTube Scraper](https://apify.com/automly/youtube-scraper) or [YouTube Video Details Scraper](https://apify.com/automly/youtube-video-details-scraper).

#### Do I need a YouTube account?

No. The scraper reads the same public search results anyone can see without signing in.

#### Can I connect YouTube Search API to other tools or AI agents?

Yes. Start runs and download results with the Apify API or the Python and JavaScript clients, send results to Make, Zapier, n8n, Google Sheets or Slack with Apify integrations and webhooks, or let AI assistants and agents run it through the Apify MCP server at [mcp.apify.com](https://mcp.apify.com).

#### Is it legal to scrape YouTube search results?

This scraper only collects public data that anyone can see on YouTube without signing in. Channel names and descriptions can still contain personal data, which may be protected by laws such as GDPR, so only scrape it for a legitimate reason, and ask a lawyer if you are unsure. You can read more in [Is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/)

YouTube Search API is an independent tool. It is not affiliated with, endorsed by or sponsored by YouTube or Google.

#### Something isn't working?

Open the **Issues** tab with your input and what you expected, or ask for a field you need. We read every one and usually reply within a day.

### ⭐ Your feedback

Have an idea or found a problem? Tell us in the **Issues** tab. If YouTube Search API saved you time, a short review on the **Reviews** tab helps other people find it.

# Actor input Schema

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

What to search YouTube for, e.g. web scraping tutorial. One search term per line; each one is searched on its own and every result names its search term.

## `maxResults` (type: `integer`):

How many results to get for each search term, e.g. 100 (1-1000). YouTube itself stops some searches earlier.

## `resultTypes` (type: `array`):

What kinds of results to keep: video, channel and/or playlist, one per line, e.g. video. Empty keeps videos only.

## `order` (type: `string`):

Order of the results, like YouTube's own search filters: relevance, upload date, view count or rating.

## `uploadDate` (type: `string`):

Only videos uploaded in this period, e.g. this week.

## `videoDuration` (type: `string`):

Only videos of this length, e.g. over 20 minutes.

## `regionCode` (type: `string`):

Two-letter country code of the results, e.g. US, GB, DE, IN.

## `language` (type: `string`):

Two-letter language code, e.g. en, es, de. It sets the language of texts like "4y ago".

## Actor input object example

```json
{
  "queries": [
    "web scraping tutorial",
    "lofi hip hop",
    "how to bake bread"
  ],
  "maxResults": 20,
  "resultTypes": [
    "video"
  ],
  "order": "relevance",
  "uploadDate": "any",
  "videoDuration": "any",
  "regionCode": "US",
  "language": "en"
}
```

# Actor output Schema

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

No description

## `results` (type: `string`):

No description

## `summary` (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": [
        "web scraping tutorial"
    ],
    "maxResults": 20,
    "resultTypes": [
        "video"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("automly/youtube-search-api").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": ["web scraping tutorial"],
    "maxResults": 20,
    "resultTypes": ["video"],
}

# Run the Actor and wait for it to finish
run = client.actor("automly/youtube-search-api").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": [
    "web scraping tutorial"
  ],
  "maxResults": 20,
  "resultTypes": [
    "video"
  ]
}' |
apify call automly/youtube-search-api --silent --output-dataset

```

## MCP server setup

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

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/y4bR5twbZbbAq64Wm/builds/n7pgjTBLbwM4ndafI/openapi.json
