# Youtube Ads Scraper (`crawlerbros/youtube-ads-scraper`) Actor

Scrape YouTube ads from Google's Ads Transparency Center. Filter by advertiser, keyword, or country; get ad ID, video/image assets, and first/last shown dates. Export to JSON, CSV, Excel, or HTML.

- **URL**: https://apify.com/crawlerbros/youtube-ads-scraper.md
- **Developed by:** [Crawler Bros](https://apify.com/crawlerbros) (community)
- **Categories:** Automation, Lead generation, SEO tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

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

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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 Ads Scraper

Scrape **YouTube ads** from the official [Google Ads Transparency Center](https://adstransparency.google.com/) — the searchable library of ads shown on YouTube. Get ad ID, advertiser, country, thumbnail, and first/last shown dates, and export the results to JSON, CSV, Excel, or HTML.

### How it works

The actor queries Google's Ads Transparency Center backend (the same source the website uses) with the YouTube platform filter enabled, so every result is an ad that was actually shown on YouTube. No browser or login is needed.

**One important limitation of the source:** the Transparency Center exposes YouTube ads as **thumbnails only** — Google does not publish the actual video file or the YouTube video ID. Each record includes the thumbnail URL and a link to the ad's page in the Transparency Center, where you can watch the ad. For ads that carry a display-network video URL, the actor resolves it to a `googlevideo.com` link when `includeVideoDetails` is enabled.

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `advertisers` | array | — | Advertiser names or AR-IDs to scrape (e.g. `Nike, Inc.`, `AR16735076323512287233`). |
| `searchTerms` | array | `["electric car"]` | Keywords to discover advertisers, then scrape their YouTube ads. |
| `countries` | array | `["US"]` | ISO-2 country codes (e.g. `US`, `GB`, `IN`, `DE`). Empty = all countries. |
| `dateFrom` / `dateTo` | string | — | Only keep ads first shown within this `YYYY-MM-DD` range. |
| `includeVideoDetails` | boolean | `false` | Fetch each ad's detail page to try resolving the video URL. |
| `maxAdvertisersPerTerm` | integer | `5` | Advertisers to scrape per keyword. |
| `maxItems` | integer | `100` | Hard cap on total ad records (1–5000). |
| `maxConcurrency` | integer | `2` | Advertisers fetched in parallel (1–5). |
| `outputFormat` | string | `json` | Additionally write `OUTPUT.csv`, `OUTPUT.xlsx`, or `OUTPUT.html` to the key-value store. |

At least one of `advertisers` or `searchTerms` must be provided.

### Output

One dataset record per ad:

```json
{
  "adId": "CR09196456782480801793",
  "advertiserId": "AR16735076323512287233",
  "advertiserName": "Nike, Inc.",
  "countryCode": "US",
  "format": "VIDEO",
  "mediaType": "video",
  "imageUrl": "https://tpc.googlesyndication.com/archive/simgad/13248366332463945265",
  "imageWidth": 348,
  "imageHeight": 154,
  "videoUrl": null,
  "firstShown": "2022-11-30T15:42:30",
  "lastShown": "2026-08-05T06:46:46",
  "adCount": 962,
  "searchTerm": "nike",
  "sourceUrl": "https://adstransparency.google.com/advertiser/AR16735076323512287233/creative/CR09196456782480801793",
  "scrapedAt": "2026-08-05T10:00:00"
}
```

#### Notes on the data

- The Transparency Center's data starts in **September 2023** and is not exhaustive — some ads are not shown.
- An "ad" here is a creative (ad variant) with its own `CR...` ID; one advertiser can have hundreds of active creatives.
- Google caps the ad library at roughly **40 creatives per advertiser per query** — the actor deduplicates by `adId` across queries, so you get the most recent 40 (the library is ordered newest-first).
- When you pass advertiser **AR-IDs directly**, the advertiser's country is not exposed by Google's API, so `countryCode` is left empty for those records (country is filled when advertisers are found via keyword search).

### Costs and limits

- Uses **~1 request** per advertiser (plus 1 per ad if `includeVideoDetails` is on). Free/no-proxy runs handle typical workloads; use Apify proxy for heavy usage.
- `maxItems` caps total records; each advertiser contributes at most ~40.

### Part of the YouTube Scrapers collection

This actor lives in [`Youtube/ads-scraper/`](../../Youtube/ads-scraper/) alongside the other YouTube scrapers. Full catalog: see [`Youtube/README.md`](../../Youtube/README.md).

| Scraper | Apify store | Folder | What it does |
|---|---|---|---|
| **YouTube Ads Scraper** *(this actor)* | [apify.com/crawlerbros/youtube-ads-scraper](https://apify.com/crawlerbros/youtube-ads-scraper) | [`ads-scraper/`](../ads-scraper/) | YouTube ads from Google's Ads Transparency Center. Filter by advertiser, country, date range; export JSON/CSV/Excel/HTML. |
| **YouTube Channel Scraper** | [apify.com/crawlerbros/youtube-channel-scraper](https://apify.com/crawlerbros/youtube-channel-scraper) | [`channel-scraper/`](../channel-scraper/) | Channel info and video listings: metadata, subscriber counts, complete video catalogs. |
| **YouTube Channel Scraper Fast** | [apify.com/crawlerbros/youtube-channel-scraper-fast](https://apify.com/crawlerbros/youtube-channel-scraper-fast) | [`channel-scraper-fast/`](../channel-scraper-fast/) | Same as Channel Scraper, optimized for speed. |
| **YouTube Comment Scraper** | [apify.com/crawlerbros/youtube-comment-scraper](https://apify.com/crawlerbros/youtube-comment-scraper) | [`comment-scraper/`](../comment-scraper/) | Video comments with full metadata: author, likes, timestamps, pinned/hearted status, reply threads. |
| **YouTube Email Scraper** | [apify.com/crawlerbros/youtube-email-scraper](https://apify.com/crawlerbros/youtube-email-scraper) | [`email-scraper/`](../email-scraper/) | Emails from channel About pages; follows Instagram/TikTok/Linktree profiles. HTTP-only. |
| **YouTube Hashtag Scraper** | [apify.com/crawlerbros/youtube-hashtag-scraper](https://apify.com/crawlerbros/youtube-hashtag-scraper) | [`hashtag-scraper/`](../hashtag-scraper/) | All videos and Shorts tagged with a hashtag. |
| **YouTube Playlist Scraper** | [apify.com/crawlerbros/youtube-playlist-scraper](https://apify.com/crawlerbros/youtube-playlist-scraper) | [`playlist-scraper/`](../playlist-scraper/) | All videos from playlists: titles, durations, thumbnails, position. |
| **YouTube Search Scraper** | [apify.com/crawlerbros/youtube-search-scraper](https://apify.com/crawlerbros/youtube-search-scraper) | [`search-scraper/`](../search-scraper/) | Search results without cookies; all YouTube search filters. HTTP-first. |
| **YouTube Shorts Scraper** | [apify.com/crawlerbros/youtube-shorts-scraper](https://apify.com/crawlerbros/youtube-shorts-scraper) | [`shorts-scraper/`](../shorts-scraper/) | Shorts from any channel or hashtag: views, likes, comment counts. |
| **YouTube Transcript Scraper** | [apify.com/crawlerbros/youtube-transcript-scraper](https://apify.com/crawlerbros/youtube-transcript-scraper) | [`transcript-scraper/`](../transcript-scraper/) | Transcripts with language selection, timestamped segments, optional Whisper. |
| **YouTube Trending Scraper** | [apify.com/crawlerbros/youtube-trending-scraper](https://apify.com/crawlerbros/youtube-trending-scraper) | [`trending-scraper/`](../trending-scraper/) | Trending and popular videos by category. |
| **YouTube Video Details Scraper** | [apify.com/crawlerbros/youtube-video-details-scraper](https://apify.com/crawlerbros/youtube-video-details-scraper) | [`video-details-scraper/`](../video-details-scraper/) | Comprehensive video details: metadata, transcript, comments, engagement, chapters, cards. |
| **YouTube Video Downloader** | [apify.com/crawlerbros/youtube-video-downloader](https://apify.com/crawlerbros/youtube-video-downloader) | [`video-downloader/`](../video-downloader/) | Download videos and upload to Apify Key-Value Store. |

# Actor input Schema

## `advertisers` (type: `array`):

Advertiser names or AR-IDs to scrape YouTube ads for (e.g. 'Nike, Inc.', 'AR16735076323512287233'). Leave empty to use searchTerms.

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

Keywords or domain names to discover advertisers, then scrape their YouTube ads (e.g. 'electric car', 'nike.com').

## `countries` (type: `array`):

ISO-3166 alpha-2 country codes to filter ads by advertiser location (e.g. 'US', 'GB', 'IN', 'DE'). Empty = all countries. Google's Ads Transparency Center data starts from September 2023.

## `dateFrom` (type: `string`):

Only return ads first shown on or after this date.

## `dateTo` (type: `string`):

Only return ads first shown on or before this date.

## `includeVideoDetails` (type: `boolean`):

Fetch the ad detail page for each ad to resolve the video URL and format (slower, but gives the actual video asset for video ads).

## `maxAdvertisersPerTerm` (type: `integer`):

Maximum advertisers to scrape per keyword (when searchTerms is used).

## `maxItems` (type: `integer`):

Hard cap on total ad records returned (1-5000).

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

Advertisers scraped in parallel. Higher is faster but increases rate-limit risk.

## `outputFormat` (type: `string`):

Dataset always receives JSON records. Additionally export results as CSV, Excel, or HTML in the key-value store (OUTPUT.csv / OUTPUT.xlsx / OUTPUT.html).

## `proxyConfiguration` (type: `object`):

Optional proxy. For moderate traffic no proxy is needed. Enable Apify proxy for high-volume scraping.

## Actor input object example

```json
{
  "advertisers": [
    "Nike, Inc.",
    "Samsung Electronics America"
  ],
  "searchTerms": [
    "electric car"
  ],
  "countries": [
    "US"
  ],
  "includeVideoDetails": false,
  "maxAdvertisersPerTerm": 5,
  "maxItems": 50,
  "maxConcurrency": 2,
  "outputFormat": "json"
}
```

# Actor output Schema

## `ads` (type: `string`):

Dataset containing the scraped YouTube ad records.

# 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": [
        "electric car"
    ],
    "countries": [
        "US"
    ],
    "includeVideoDetails": false,
    "maxAdvertisersPerTerm": 5,
    "maxItems": 50,
    "maxConcurrency": 2,
    "outputFormat": "json"
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlerbros/youtube-ads-scraper").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": ["electric car"],
    "countries": ["US"],
    "includeVideoDetails": False,
    "maxAdvertisersPerTerm": 5,
    "maxItems": 50,
    "maxConcurrency": 2,
    "outputFormat": "json",
}

# Run the Actor and wait for it to finish
run = client.actor("crawlerbros/youtube-ads-scraper").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 '{
  "searchTerms": [
    "electric car"
  ],
  "countries": [
    "US"
  ],
  "includeVideoDetails": false,
  "maxAdvertisersPerTerm": 5,
  "maxItems": 50,
  "maxConcurrency": 2,
  "outputFormat": "json"
}' |
apify call crawlerbros/youtube-ads-scraper --silent --output-dataset

```

## MCP server setup

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

```

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/amteAb817e0rkBuiA/builds/XoGqJ89YXlgxXXkOH/openapi.json
