# TikTok Top Ads Spy Scraper $4/1k (`crucial_binoculars/tiktok-top-ads-spy-scraper`) Actor

Scrape TikTok’s Top Ads by keyword, region, lookback period, and performance metrics. Get ad titles, brand names, CTR, likes, cost tiers, and direct video URLs. Unlock premium audience insights (age, gender, region, and device data) with a single toggle. No login or cookies required. Works globally.

- **URL**: https://apify.com/crucial\_binoculars/tiktok-top-ads-spy-scraper.md
- **Developed by:** [Iliya Musa](https://apify.com/crucial_binoculars) (community)
- **Categories:** Automation, Social media, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 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.

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

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

## TikTok Video Data Extractor & Metadata Scraper

Extract comprehensive video metadata, engagement analytics, author profiles, and direct media URLs from TikTok videos in bulk. This high-performance scraper delivers rich, deeply nested platform data structures instantly.

### What does this actor do?

This actor takes a list of TikTok video URLs and extracts complete, unflattened video data including:
- Video metadata (ID, title, duration, region)
- Direct media URLs (play, wmplay, hdplay streams)
- Engagement metrics (views, likes, comments, shares)
- Audio/music information (track details, artist, album)
- Author profiles (ID, username, nickname)
- Creation timestamps and processing times

### Why use this actor?

- **Deep Nested Data Structure**: Preserves authentic, multi-layered platform schema for maximum data fidelity
- **True Bulk Processing**: Process hundreds of video links at once with zero structural bottlenecking
- **Direct HD Media Links**: Extract both watermarked and non-watermarked high-definition playback streams
- **Complete Audio Profiling**: Get full background track identities, artist tags, albums, and audio stream URLs
- **Fast & Reliable**: High-performance API-based extraction with minimal latency

### Input

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `urls` | Array of strings | Yes | Array of TikTok video URLs to process |

#### Input Example

```json
{
  "urls": [
    "https://www.tiktok.com/@billieeilish/video/7050551461734042926"
  ]
}
````

### Output

Each processed video returns a complete data object with the following structure:

| Field | Type | Description |
|-------|------|-------------|
| `inputUrl` | String | The exact TikTok URL requested |
| `code` | Number | Response status code (0 = success) |
| `msg` | String | Response message |
| `processed_time` | Number | Time taken to process the request (seconds) |
| `data` | Object | Complete video data object |

#### Output Example

```json
[
  {
    "inputUrl": "https://www.tiktok.com/@billieeilish/video/7050551461734042926",
    "code": 0,
    "msg": "success",
    "processed_time": 0.8612,
    "data": {
      "id": "7050551461734042926",
      "region": "US",
      "title": "can't be good at everything",
      "duration": 29,
      "play": "https://v16m.tiktokcdn-us.com/...",
      "wmplay": "https://v16m.tiktokcdn-us.com/...",
      "hdplay": "https://v16.tokcdn.com/...",
      "size": 2327756,
      "wm_size": 2356556,
      "hd_size": 10829374,
      "music_info": {
        "id": "6929763762322343937",
        "title": "These Days",
        "author": "Nico",
        "album": "Chelsea Girl"
      },
      "play_count": 204139265,
      "digg_count": 27640097,
      "comment_count": 198682,
      "share_count": 69286,
      "download_count": 123673,
      "collect_count": 477433,
      "create_time": 1641584436,
      "author": {
        "id": "6879693940111901701",
        "unique_id": "billieeilish",
        "nickname": "BILLIE EILISH"
      }
    }
  }
]
```

### Important Notes

- This scraper requires a valid `TIKWM_API_KEY` environment variable
- Only publicly available TikTok video data is extracted
- Processing includes a 1-second delay between requests for rate limiting
- Failed requests are logged but do not stop the entire batch process

### Legal & Compliance

This actor only collects public data points explicitly made available by platform accounts. Data extraction practices conform to global digital compliance standards. Please verify local compliance expectations (such as GDPR or CCPA) if your processing routines capture identifiable creator profiles.

# Actor input Schema

## `keyword` (type: `string`):

Filter ad copies containing specific keywords or brand terms. Leave blank to fetch top trending ads broadly.

## `countryCodes` (type: `string`):

Comma-separated ISO country codes to filter the target ad database (e.g., US, CA, GB, DE).

## `orderBy` (type: `string`):

Select the primary metrics used to rank and filter top campaigns.

## `period` (type: `string`):

Select the active campaign lookback history duration.

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

The exact total number of final ad elements to collect.

## `includeAdDetails` (type: `boolean`):

Toggle TRUE to run sub-queries capturing target age groups, gender ratios, regional breakouts, and target device systems.

## Actor input object example

```json
{
  "keyword": "",
  "countryCodes": "US",
  "orderBy": "ctr",
  "period": "30",
  "maxItems": 50,
  "includeAdDetails": 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 = {
    "orderBy": "ctr"
};

// Run the Actor and wait for it to finish
const run = await client.actor("crucial_binoculars/tiktok-top-ads-spy-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 = { "orderBy": "ctr" }

# Run the Actor and wait for it to finish
run = client.actor("crucial_binoculars/tiktok-top-ads-spy-scraper").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 '{
  "orderBy": "ctr"
}' |
apify call crucial_binoculars/tiktok-top-ads-spy-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=crucial_binoculars/tiktok-top-ads-spy-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "TikTok Top Ads Spy Scraper $4/1k",
        "description": "Scrape TikTok’s Top Ads by keyword, region, lookback period, and performance metrics. Get ad titles, brand names, CTR, likes, cost tiers, and direct video URLs. Unlock premium audience insights (age, gender, region, and device data) with a single toggle. No login or cookies required. Works globally.",
        "version": "0.0",
        "x-build-id": "ja3H5cAxdTmhowf4f"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/crucial_binoculars~tiktok-top-ads-spy-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-crucial_binoculars-tiktok-top-ads-spy-scraper",
                "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/crucial_binoculars~tiktok-top-ads-spy-scraper/runs": {
            "post": {
                "operationId": "runs-sync-crucial_binoculars-tiktok-top-ads-spy-scraper",
                "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/crucial_binoculars~tiktok-top-ads-spy-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-crucial_binoculars-tiktok-top-ads-spy-scraper",
                "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",
                "required": [
                    "countryCodes",
                    "orderBy",
                    "period",
                    "maxItems"
                ],
                "properties": {
                    "keyword": {
                        "title": "🔍 Search Keyword",
                        "type": "string",
                        "description": "Filter ad copies containing specific keywords or brand terms. Leave blank to fetch top trending ads broadly.",
                        "default": ""
                    },
                    "countryCodes": {
                        "title": "🌍 Country Target Selection",
                        "type": "string",
                        "description": "Comma-separated ISO country codes to filter the target ad database (e.g., US, CA, GB, DE).",
                        "default": "US"
                    },
                    "orderBy": {
                        "title": "📈 Performance Optimization Metric",
                        "enum": [
                            "ctr",
                            "impression",
                            "like",
                            "cvr",
                            "play_6s_rate"
                        ],
                        "type": "string",
                        "description": "Select the primary metrics used to rank and filter top campaigns.",
                        "default": "ctr"
                    },
                    "period": {
                        "title": "📅 Historical Lookback History Window",
                        "enum": [
                            "7",
                            "30",
                            "180"
                        ],
                        "type": "string",
                        "description": "Select the active campaign lookback history duration.",
                        "default": "30"
                    },
                    "maxItems": {
                        "title": "🔢 Maximum Items Limit",
                        "minimum": 1,
                        "type": "integer",
                        "description": "The exact total number of final ad elements to collect.",
                        "default": 50
                    },
                    "includeAdDetails": {
                        "title": "👑 Activate Enriched Target Insights",
                        "type": "boolean",
                        "description": "Toggle TRUE to run sub-queries capturing target age groups, gender ratios, regional breakouts, and target device systems.",
                        "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
