# YouTube Data API Scraper: Search, Channels, Videos & Playlists (`fjordlabs/youtube-data`) Actor

Search YouTube and export channel stats, latest uploads, video details (views, likes, duration, tags, category) and playlists via the official YouTube Data API v3 with your own free key.

- **URL**: https://apify.com/fjordlabs/youtube-data.md
- **Developed by:** [Mivah](https://apify.com/fjordlabs) (community)
- **Categories:** Videos, Social media, Marketing
- **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 Data API Scraper: search, channels, videos and playlists

Get **YouTube search results, channel statistics, a channel's latest uploads, full video details and playlists** as clean rows, through the **official YouTube Data API v3** with **your own free API key**. Every video row has views, likes, comments, duration (ISO and seconds), tags, category, topics, language, captions flag, HD/SD, made-for-kids and thumbnail. Every channel row has subscribers, total views, video count, country, @handle, keywords and the uploads playlist.

Built for marketers and agencies doing influencer research and competitor tracking, creators benchmarking channels, analysts building video datasets, SEO teams researching YouTube keywords, and AI agents that need "what are the top videos about X?" or "how big is this channel?". No browser, no proxies, no scraping of youtube.com pages: just Google's official API, so runs are fast, stable and cheap.

**Bring your own key (BYOK).** A YouTube Data API key is free in Google Cloud Console and comes with **10,000 quota units a day**. Google doesn't bill you for normal use; you only pay our small per-result fee on Apify. The key is a secret input: stored encrypted by Apify, sent only to Google in a request header, never logged and never written to the output.

### What you get

- 🔎 **Search:** videos, channels or playlists for any keyword, with country, language, sort order (relevance, date, views, rating), video length and published-after/before filters, up to 500 results per term
- 📺 **Channels:** channel IDs, @handles or channel URLs → stats + the newest uploads (or all of them, up to 20,000) with full details
- 🎬 **Videos:** IDs or any YouTube link (watch, youtu.be, Shorts, live) → full details, 50 videos per quota unit
- 📃 **Playlists:** playlist IDs or URLs → playlist info + its videos in playlist order
- 📊 **Quota tracking:** the log and the `SUMMARY` record show how many quota units the run used, and `maxQuotaUnits` stops the run before it eats your whole daily quota
- 🆓 **Failed lookups are free:** a deleted video, an unknown channel, a missing key or a used-up quota comes back as an `error` row that isn't charged

### How to get a key (2 minutes)

1. Open [Google Cloud Console](https://console.cloud.google.com/), create (or pick) a project.
2. **APIs & Services → Library →** "YouTube Data API v3" **→ Enable**.
3. **APIs & Services → Credentials → Create credentials → API key.** Optionally restrict it to the YouTube Data API v3.
4. Paste it into the **apiKey** field.

### Input examples

Top 50 videos about a keyword in Denmark from the last month, most viewed first:

```json
{
  "apiKey": "AIza…",
  "mode": "search",
  "searchQueries": ["web scraping tutorial", "python automation"],
  "maxResults": 50,
  "order": "viewCount",
  "regionCode": "DK",
  "publishedAfter": "30 days"
}
```

Channel stats plus the 20 newest uploads of each channel:

```json
{
  "apiKey": "AIza…",
  "mode": "channels",
  "channels": ["@GoogleDevelopers", "https://www.youtube.com/channel/UC_x5XG1OV2P6uZZ5FSM9Ttw"],
  "maxVideosPerChannel": 20
}
```

Details for a list of videos:

```json
{ "apiKey": "AIza…", "mode": "videos", "videos": ["https://youtu.be/jNQXAC9IVRw", "dQw4w9WgXcQ"] }
```

### Output example (one video row, shortened)

```json
{
  "type": "video",
  "id": "jNQXAC9IVRw",
  "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
  "title": "Me at the zoo",
  "publishedAt": "2005-04-24T03:31:52Z",
  "channelId": "UC4QobU6STFB0P71PMvOGN5A",
  "channelTitle": "jawed",
  "duration": "PT19S",
  "durationSeconds": 19,
  "viewCount": 380000000,
  "likeCount": 18000000,
  "commentCount": 10500000,
  "tags": ["zoo"],
  "category": "Film & Animation",
  "topics": ["Knowledge"],
  "defaultAudioLanguage": "en",
  "hasCaptions": true,
  "definition": "hd",
  "madeForKids": false,
  "thumbnail": "https://i.ytimg.com/vi/jNQXAC9IVRw/hqdefault.jpg",
  "source": "video",
  "rank": null
}
```

Channel rows have `type: "channel"` with `title`, `handle`, `country`, `subscriberCount`, `videoCount`, `viewCount`, `publishedAt`, `keywords`, `topics` and `uploadsPlaylistId`. Search rows also carry `searchQuery` and `rank` (position in the results). Videos from a channel or playlist carry `source` (`channel:UC…` / `playlist:PL…`) and their position.

### Quota: how far your free 10,000 units go

| Call | Quota units | Example |
|---|---|---|
| One search page (up to 50 results) | 100 | 50 search results ≈ 101 units with details |
| Video / channel / playlist details | 1 per 50 items | 1,000 videos by ID = 20 units |
| Channel uploads / playlist videos | 1 per 50 videos (+1 for details) | a channel's 500 newest videos ≈ 21 units |

So one key handles about **4,900 search results a day**, or **hundreds of thousands of channel/playlist/video lookups**. Search is the expensive part; for channels prefer channel mode over searching.

### Use cases

- **Influencer marketers** pull channel stats (subscribers, total views, video count) for a shortlist of creators and rank them in a spreadsheet.
- **SEO and content teams** search a keyword by country and language, sorted by views, to see which videos and titles win a topic.
- **Competitor trackers** schedule a weekly run on rival channels' newest uploads and watch views, likes and comments grow.
- **Analysts** build video datasets from playlists or ID lists with duration, tags, category and language.

### Pricing

| Event | Price |
|---|---|
| Actor start | $0.00005 |
| Result (one video, channel or playlist row) | **$0.0005** |
| Error row (not found, bad key, quota used up…) | **free** |

1,000 videos with full stats = **$0.50**, cheaper than the scraping-based Actors at about $1 per 1,000, and without their blocking or proxy problems. The YouTube API itself is free within your key's quota.

### Limits

- You need your own YouTube Data API v3 key. Without one, the run finishes at once with one free row that explains how to get it.
- Your key's daily quota (10,000 units by default, reset at midnight Pacific time) is the real limit. When it runs out the run stops with one free `quota` row. `maxQuotaUnits` (default 5,000) caps a single run.
- YouTube returns at most about 500 results per search term; search counts and ordering are YouTube's own and differ a bit from the website.
- Custom channel URLs (`youtube.com/c/Name` or `youtube.com/Name`) can't be looked up directly by the API; the Actor uses the top channel search hit (100 units) and warns. Use @handles or `UC…` IDs where you can.
- Private and deleted videos in playlists and uploads are skipped. Channels can hide their subscriber count (`subscriberCount: null`, `subscribersHidden: true`); YouTube rounds public subscriber counts.
- No comments, transcripts or downloads, and no scraping of youtube.com. Only public data that the official API returns. You use the API under the [YouTube API Services Terms](https://developers.google.com/youtube/terms/api-services-terms-of-service).
- With a **max charge per run**, the Actor stops when it's reached, before spending more of your quota.

### Changelog

- **2026-11-24:** More FAQs and use cases in this README.
- **2026-11-10:** Invalid input now ends as a successful run with one free error row that says what to fix, instead of a failed run.
- **2026-11-08:** Built, reviewed and tested on Apify before launch.

### How to use YouTube Data API Scraper

1. Paste your free **YouTube Data API v3 key** (Google Cloud Console → APIs & Services → Credentials).
2. Pick **what to get**: a keyword **search**, **channels** with their latest uploads, specific **videos**, or **playlists**.
3. For search, set the country, language, sort order and a **published after** date if you like.
4. Click **Start**, then export videos and channels as JSON, CSV or Excel, or schedule it to track channels over time.

### Use it from code (API)

Run it from Python with the official client (`pip install apify-client`):

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("fjordlabs/youtube-data").call(run_input={'apiKey': 'AIza…', 'mode': 'channels', 'channels': ['@GoogleDevelopers'], 'maxVideosPerChannel': 20})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

Or with one HTTP call that returns the results directly:

```bash
curl -X POST "https://api.apify.com/v2/acts/fjordlabs~youtube-data/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>" \
  -H "Content-Type: application/json" -d '{"apiKey": "AIza\u2026", "mode": "channels", "channels": ["@GoogleDevelopers"], "maxVideosPerChannel": 20}'
```

It also works with Make, Zapier, n8n, Google Sheets and webhooks through Apify's integrations.

### Use with AI agents (MCP)

Agents can call this Actor as a tool through Apify's MCP server (mcp.apify.com). Add `fjordlabs/youtube-data` to the server's Actors. Results are clean JSON with a small default size, so they fit well in an agent's context.

### FAQ

**Do I need an API key?**
Yes, your own free YouTube Data API v3 key. It comes with 10,000 quota units a day, and Google doesn't charge for normal use. The key is a secret input and is never logged.

**How many results does my free quota give?**
About 4,900 search results a day (search costs 100 units per 50 results), or hundreds of thousands of video, channel and playlist lookups (1 unit per 50).

**What happens when my quota runs out?**
The run stops with one free error row. `maxQuotaUnits` caps each run (default 5,000) so one run can't use your whole day.

**Does it scrape youtube.com?**
No. It only calls Google's official API, so there's no blocking, no proxies and no broken runs when YouTube changes its pages.

**Can I get comments or transcripts?**
No. This Actor returns public video, channel and playlist metadata only.

**Is there an API for YouTube search results and channel stats?**
Yes, the official YouTube Data API v3, which this Actor calls with your own free key. For a few lookups the API alone is fine. The Actor adds URL and handle parsing, paging, batching of 50 items per request, normalized video and channel rows, quota tracking, scheduling and CSV or Excel export without code.

**How much does it cost to get 1,000 YouTube videos?**
$0.0005 per result row, so 1,000 videos with full stats cost $0.50, plus the tiny run-start fee. Google's API is free within your key's quota, and error rows are not charged.

**How do I get all videos from a YouTube channel?**
Use `channels` mode with the channel's @handle, `UC...` ID or URL and raise `maxVideosPerChannel` (up to 20,000). Channel uploads cost about 1 quota unit per 50 videos, so a channel's 500 newest videos use roughly 21 units.

**Why does a search use so much of my quota?**
Each search page costs 100 quota units on Google's side, while video, channel and playlist lookups cost 1 unit per 50 items. Use `maxQuotaUnits` (default 5,000) to cap a run, and prefer channel mode over searching when you know the channels.

**Am I charged for errors?**
No. Rows that fail are never charged; you only pay for results.

### More from fjordlabs

- [Google Trends Scraper](https://apify.com/fjordlabs/google-trends)
- [Google Trends Trending Now](https://apify.com/fjordlabs/google-trending-now)
- [Google News Scraper](https://apify.com/fjordlabs/google-news)
- [Google Play Reviews & App Data Scraper](https://apify.com/fjordlabs/google-play-reviews)
- [App Store Reviews & App Data Scraper (iOS)](https://apify.com/fjordlabs/app-store-reviews)
- [Bulk PageSpeed Insights & Lighthouse Audit](https://apify.com/fjordlabs/pagespeed-audit)
- [Google Autocomplete Keyword Expander](https://apify.com/fjordlabs/google-autocomplete)
- [App Store & Google Play Search Rank + Top Charts (ASO)](https://apify.com/fjordlabs/app-store-search-charts)
- [SEO & AI-Search Readiness Audit](https://apify.com/fjordlabs/seo-ai-readiness-audit)
- [Website Tech Stack Detector](https://apify.com/fjordlabs/tech-stack-detector)
- [Steam Reviews & Game Data Scraper](https://apify.com/fjordlabs/steam-reviews)
- [Chrome Web Store Extension Details Scraper](https://apify.com/fjordlabs/chrome-web-store)
- [Google Ads Transparency Center Scraper](https://apify.com/fjordlabs/google-ads-transparency)
- [Hacker News Scraper](https://apify.com/fjordlabs/hacker-news)
- [Shopify Store Products Scraper](https://apify.com/fjordlabs/shopify-products)
- [Sitemap URL Extractor](https://apify.com/fjordlabs/sitemap-extractor)
- [EU Public Tenders Scraper (TED)](https://apify.com/fjordlabs/eu-tenders-ted)
- [Domain Intel: WHOIS/RDAP, DNS, SSL, SPF/DMARC](https://apify.com/fjordlabs/domain-intel)
- [App Store & Google Play App Details + Developer Portfolio](https://apify.com/fjordlabs/app-details-portfolio)
- [Website Screenshot API: Full Page, Mobile, PDF](https://apify.com/fjordlabs/website-screenshot)
- [Wayback Machine Site History](https://apify.com/fjordlabs/wayback-history)
- [AI Brand Visibility Tracker](https://apify.com/fjordlabs/ai-brand-visibility)
- [Apple Podcasts Scraper: Search, Top Charts & Episodes](https://apify.com/fjordlabs/apple-podcasts)
- [Nordic Company Registry (Norway + Finland)](https://apify.com/fjordlabs/nordic-company-registry)
- [Google Patents Scraper](https://apify.com/fjordlabs/google-patents)

# Actor input Schema

## `apiKey` (type: `string`):

Free key from Google Cloud Console → APIs & Services → Credentials (enable "YouTube Data API v3" for the project). Default quota: 10,000 units a day. Stored encrypted, never logged or written to the output.

## `mode` (type: `string`):

Search results, channels (with their latest uploads), specific videos, or playlists (with their videos).

## `searchQueries` (type: `array`):

One search per line, e.g. "web scraping tutorial". Each page of up to 50 results costs 100 quota units of your key.

## `searchType` (type: `string`):

Videos, channels or playlists.

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

YouTube returns at most about 500 results per search. 50 results = 1 search page = 100 quota units.

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

How YouTube orders search results.

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

Two-letter country code (US, GB, DK, DE…) to get the results YouTube shows in that country.

## `relevanceLanguage` (type: `string`):

Prefer results in this language (en, da, de, es…).

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

Search filter for videos: short (< 4 min), medium (4–20 min), long (> 20 min).

## `safeSearch` (type: `string`):

YouTube's restricted-content filter for search.

## `publishedAfter` (type: `string`):

ISO date (2026-10-01), date-time, or relative like "7 days", "24 hours", "3 months". Filters search results and channel/playlist videos.

## `publishedBefore` (type: `string`):

ISO date (a date alone means the end of that day) or relative like "1 day".

## `channels` (type: `array`):

Channel IDs (UC…), @handles, or URLs like https://www.youtube.com/@Google or /channel/UC…. One row per channel with its stats, then its latest uploads.

## `maxVideosPerChannel` (type: `integer`):

How many of each channel's newest videos to return with full details (0 = channel info only). Costs about 2 quota units per 50 videos.

## `videos` (type: `array`):

Video IDs or URLs (watch?v=, youtu.be/, /shorts/, /live/). Up to 50 videos per quota unit.

## `playlists` (type: `array`):

Playlist IDs (PL…) or URLs with list=. One row per playlist, then its videos in playlist order.

## `maxVideosPerPlaylist` (type: `integer`):

0 = playlist info only.

## `fetchDetails` (type: `boolean`):

Look up stats, duration, tags and category for every search hit (1 extra quota unit per 50 results). Off = only the search snippet (title, channel, date).

## `maxQuotaUnits` (type: `integer`):

Stops before this run would use more of your key's daily quota (10,000 units by default). Search = 100 units per page; everything else = 1 unit per 50 items.

## Actor input object example

```json
{
  "mode": "search",
  "searchQueries": [
    "web scraping tutorial"
  ],
  "searchType": "video",
  "maxResults": 10,
  "order": "relevance",
  "videoDuration": "any",
  "safeSearch": "moderate",
  "maxVideosPerChannel": 10,
  "maxVideosPerPlaylist": 50,
  "fetchDetails": true,
  "maxQuotaUnits": 5000
}
```

# Actor output Schema

## `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 = {
    "mode": "search",
    "searchQueries": [
        "web scraping tutorial"
    ],
    "maxResults": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("fjordlabs/youtube-data").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 = {
    "mode": "search",
    "searchQueries": ["web scraping tutorial"],
    "maxResults": 10,
}

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

```

## MCP server setup

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

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/COFpxQAeUsiZOFhnO/builds/hFFSBLflOGiiTOgrW/openapi.json
