# TikTok Ads Scraper (`datahamster/tiktok-ads-scraper`) Actor

TikTok Ads Scraper for the public TikTok Ad Library: ads by keyword, advertiser, pasted Ad Library link, region and date range. Many searches per run with dedupe, numeric reach and impression ranges, regions and targeting, ad and video links. Monitor mode returns only new ads.

- **URL**: https://apify.com/datahamster/tiktok-ads-scraper.md
- **Developed by:** [Viktor Dubnytskiy](https://apify.com/datahamster) (community)
- **Categories:** Marketing, 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.80 / 1,000 result items

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

## TikTok Ads Scraper

TikTok Ads Scraper reads the public TikTok Ad Library (library.tiktok.com, the ad repository TikTok publishes for the EU, EEA, Switzerland, the UK, Turkey and Brazil) and gives you one row per ad: advertiser, ad text, format, industry, first and last shown date, TikTok's reach bucket as text and as numbers, the video and cover image, and the link to the ad in the library. Turn on details to add the advertiser's business id and country, paid-for-by, the regions the ad ran in with impressions per region, and the targeting summary. No TikTok account, no cookies.

**Try it:** the prefilled example returns 12 rows in about 28 seconds and costs about $0.015. Results cost $1.00 per 1,000.

Coverage: TikTok shows at most 84 ads (7 pages) per Ad Library search, so a broad keyword is read deeper by splitting the date range into shorter windows (186 different `nike` ads from a 4-day range in a test run, where one search stops at 84). TikTok sometimes refuses or cuts a page ("system busy", or fewer than 12 ads while its total says there are more); the actor then reads the search again on a new browser context, which adds 10 to 20 seconds (the slowest of the three prefilled test runs, 48 seconds, had one such retry). Ad details are throttled by TikTok to roughly one page every 15 to 25 seconds, so `includeDetails` is off by default and meant for short lists.

### Why this one

- **Many searches in one run, deduplicated.** Give lists of keywords, advertiser names, regions and pasted Ad Library links; every combination is one search and an ad found twice is returned and charged once. The Ad Library repeats ads across its own pages and date windows: a 4-day `nike` test run dropped 198 repeats while collecting 186 ads. The leading TikTok Ads actor takes one query, one advertiser name and one country per run.
- **Deeper than one search.** When a search hits TikTok's 84-ad limit, the date range is split in halves (newer half first) and searched again, down to single days, until your per-search limit is reached.
- **Numbers, not only labels.** `reachRange` "100K-200K" also comes as `reachMin` 100000 and `reachMax` 200000; impressions per region and the targeting audience size ("333.5M-407.5M") come as numbers too.
- **Monitor mode.** Save a task in monitor mode and each run returns only ads that are new since the last run, with an optional webhook or Telegram message. Good for watching a competitor's new TikTok ads every morning.
- **Paste a link.** Any search URL from library.tiktok.com works as input, including an advertiser's "all ads" link (exact advertiser by business id) and the site's own filters for reach, age, gender and ad status.
- Price: $1.00 per 1,000 ads, $0.90 on SILVER, $0.80 on GOLD and higher. Platform usage is billed by Apify on top.

### What you get

Real rows from the example dataset (`keywords: ["nike"]`, `regions: ["DE"]`, 12 ads):

| advertiserName | adText | firstShown | lastShown | reachRange | reachMax | industry |
|---|---|---|---|---|---|---|
| Unisport A/S | Die neuen Nike Mercurial Superfly 11 ... | 2026-10-29 | 2026-11-17 | 0-1K | 1000 | Sports & Outdoor |
| (masked, see below) | #fyp #moda #corrientes #zapatillas #nike ... | 2026-11-17 | 2026-11-17 | 0-1K | 1000 | |
| NIKE Retail B.V. | | 2026-10-23 | 2026-10-30 | 10K-100K | 100000 | Apparel & Accessories |

A search row (video and image URLs shortened):

```json
{
  "adId": "1879799622733857",
  "adUrl": "https://library.tiktok.com/ads/detail/?ad_id=1879799622733857",
  "advertiserName": "NIKE Retail B.V.",
  "advertiserMasked": false,
  "adText": null,
  "adFormat": "video",
  "industry": "Apparel & Accessories",
  "status": "active",
  "firstShown": "2026-10-23",
  "lastShown": "2026-10-30",
  "reachRange": "10K-100K",
  "reachMin": 10000,
  "reachMax": 100000,
  "videoUrl": "https://library.tiktok.com/api/v1/cdn/1795020237/video/...",
  "coverImageUrl": "https://p16-common-sign.tiktokcdn.com/...",
  "query": "nike",
  "queryRegion": "DE",
  "rank": 7,
  "detailsFetched": false
}
```

With `includeDetails: true` a row adds (an ad of FISIA COMERCIO DE PRODUTOS ESPORTIVOS SA, Nike's Brazilian retailer, from a test run):

```json
{
  "advertiserBusinessId": "7058334307189785345",
  "advertiserAdsUrl": "https://library.tiktok.com/ads?adv_name=FISIA%20COMERCIO%20DE%20PRODUTOS%20ESPORTIVOS%20SA&region=all&query_type=2&adv_biz_ids=7058334307189785345",
  "advertiserCountry": "Brazil",
  "paidBy": "FISIA COMERCIO DE PRODUTOS ESPORTIVOS SA",
  "advertiserTiktokHandle": "nike",
  "impressions": "0-1K",
  "impressionsMin": 0,
  "impressionsMax": 1000,
  "regionCount": 1,
  "regions": ["BR"],
  "regionReach": [{"region": "BR", "impressions": "0-1K", "impressionsMin": 0, "impressionsMax": 1000}],
  "targeting": {
    "ages": ["18-24", "25-34", "35-44", "45-54", "55+"],
    "genders": ["female", "male", "unknown"],
    "audienceSize": "333.5M-407.5M",
    "audienceSizeMin": 333500000,
    "audienceSizeMax": 407500000,
    "customAudience": true,
    "interests": null,
    "countries": [], "languages": [], "deviceModels": []
  },
  "detailsFetched": true
}
```

Full row: `adId`, `adUrl`, `advertiserName`, `advertiserMasked`, `advertiserBusinessId`, `advertiserAdsUrl`, `advertiserCountry`, `paidBy`, `advertiserTiktokHandle`, `adText`, `adFormat` (video, image or text), `industry`, `objective`, `status` (active or removed), `removalReason`, `firstShown`, `lastShown`, `reachRange`, `reachMin`, `reachMax`, `impressions`, `impressionsMin`, `impressionsMax`, `videoUrl`, `coverImageUrl`, `imageUrls`, `regionCount`, `regions`, `regionReach`, `targeting`, `query`, `queryAdvertiser`, `queryRegion`, `rank`, `detailsFetched`, `scrapedAt`.

### Use cases

- **Competitor research**: every TikTok ad a brand ran in Europe, with dates, reach and the creative.
- **Creative inspiration**: collect ad texts and videos by keyword ("black friday", "free shipping") and region before writing your own.
- **Agencies** track several clients' competitors in one scheduled task with monitor mode.
- **Market research**: who advertises in an industry and country, and for how long.

### Input

| Field | Meaning | Default |
|---|---|---|
| `keywords` | Words to search, one search per keyword and region. A phrase in double quotes is an exact match. | prefilled `["nike"]` |
| `advertisers` | Advertiser names as the library shows them ("Snipes SE"). With Strict advertiser match only ads whose advertiser name contains the name are kept. | empty |
| `searchUrls` | Search links copied from library.tiktok.com/ads; region, dates, sort and filters of the link are kept (in monitor mode the date range is Last N days). `advertiserAdsUrl` from the results is such a link for one exact advertiser. | empty |
| `regions` | AT, BE, BG, BR, CH, CY, CZ, DE, DK, EE, ES, FI, FR, GB, GR, HR, HU, IE, IS, IT, LI, LT, LU, LV, MT, NL, NO, PL, PT, RO, SE, SI, SK, TR; one search per region | all regions (prefilled `["DE"]`) |
| `lastDays` | Ads shown in the last N days (UTC) | 30 |
| `startDate`, `endDate` | `YYYY-MM-DD`, override Last N days | empty |
| `sortBy` | `last_shown_date,desc` or `impression,desc` | `last_shown_date,desc` |
| `includeDetails` | Open each ad's detail page (advertiser id and country, paid-for-by, objective, regions, impressions, targeting). Slow, see Limits. | `false` |
| `maxAdsPerSearch` | Stop each search after this many new ads | 100 |
| `splitDateRange` | Split the date range when a search hits the 84-ad limit (scrape mode) | `true` |
| `strictAdvertiserMatch` | For advertiser names, keep only that advertiser's ads | `true` |
| `maxItems` | Stop the whole run after this many ads | 100 |
| `mode` | `scrape`, or `monitor` (only ads not seen before) | `scrape` |
| `monitorStateId`, `webhookUrl`, `telegramBotToken`, `telegramChatId` | Monitor state key and alerts | empty |

To watch a competitor, run one search with its name and `includeDetails: true`, copy `advertiserAdsUrl` into `searchUrls`, set Mode to monitor and add a schedule (for example cron `0 7 * * *`). The first run records what is there and returns nothing (baseline). Every later run returns only new ads. A monitor run that crashed holds its state until its timeout; if later runs end as `overlapping_run`, wait for that timeout or set a new `monitorStateId`.

### How it works

1. Each keyword, advertiser, link and region becomes one Ad Library search. The actor opens the same URL the library's search form produces in a plain headless Chromium and reads the answers of the requests the page itself makes; "View more" loads the next 12 ads. Images, video and fonts are not downloaded.
2. A search stops as soon as it has enough new ads for your limits, at the end of the results, or at TikTok's 7-page limit. With `splitDateRange` a search that reached page 7 without enough new ads is repeated on the newer and the older half of its date range; a window TikTok refuses is counted in `adLibrary.windowWalls`.
3. Ads are deduplicated by ad id across all searches of the run.
4. With `includeDetails`, each returned ad's detail page is opened, one at a time.
5. Pages go through Apify residential proxies with a German exit (TikTok answers "system busy" to datacenter exits after a few minutes, and other exits sometimes got cut answers). A search refused on its first page, or cut short on a later page (fewer than 12 ads while TikTok's total says there are more), is read again on a new browser context, up to 3 times; ads already returned are skipped. If every search was refused and nothing was returned, `RUN_SUMMARY` says `blocked`; it counts searches, pages, windows, duplicates, masked advertisers and detail pages under `adLibrary`.

### Pricing

| Event | FREE / BRONZE | SILVER | GOLD and higher |
|---|---|---|---|
| result (one ad) | $0.001 | $0.0009 | $0.0008 |
| monitor-check (one monitor run) | $0.005 | $0.0045 | $0.004 |
| change (one new ad in monitor mode) | $0.001 | $0.0009 | $0.0008 |

You pay only for ads actually returned; in monitor mode detail pages are opened only for ads that can be new (never on the baseline run or for ads seen before). `includeDetails` costs no extra event, only platform usage (about 20 to 40 seconds of browser time, about $0.003, per ad). Platform usage (compute and proxy traffic) is billed by Apify on top: about $0.003 for the prefilled run (25 to 48 seconds, median 28), about $0.03 for 186 ads with date splitting (6 minutes).

**Found it useful?** A short review on the Store page helps other people find this actor. If something is wrong, open an issue on the actor page and we will answer within a day.

### What is NOT collected

Advertisers are businesses, but small TikTok advertisers can be private persons. An advertiser's name, business id, country, paid-for-by and TikTok handle are returned only when the name carries a company legal form (GmbH, SE, SA, Ltd, A/S, B.V., Inc...; short forms such as SA, AS or AB only written in capitals as the first or last word of a mixed-case name, so "Joao de Sa" stays masked; in an all-caps name only a dotted short form such as S.A. counts, so "JOAO DE SA" stays masked; words like Shop, Store or Official do not count) or TikTok links it to a verified business account. With `includeDetails`, an advertiser TikTok marks as a verified business account is shown even without a legal form (for example "FISIA COMERCIO DE PRODUTOS ESPORTIVOS SA", masked in plain search rows because its "SA" is not dotted). Otherwise the row keeps the ad and says `advertiserMasked: true` with those fields empty, an ad text equal to the advertiser's name is dropped, and phone numbers, e-mail addresses and @handles in the ad text are replaced with `[removed]`. With an advertiser name in `advertisers` and Strict advertiser match on, masked advertisers are never returned. When the library shows no advertiser name at all, `advertiserName` is empty and `advertiserMasked` is `false` (nothing was hidden). The TikTok handle is returned only for business accounts; profile photos and follower counts are not read. The library has no viewer data.

### Limits

- One Ad Library search shows at most 84 ads. Date splitting reads more, but a very broad keyword can have thousands of ads (TikTok reports `total` up to 5,000), and each extra window costs a page load (about 5 seconds per page of 12).
- Detail pages are throttled: TikTok answers "system busy" after one or two quick reads and accepts the next one after about 15 seconds. The actor waits and retries (15 s, then 30 s); after 5 refused detail pages in a row it stops asking and returns the remaining ads with `detailsFetched: false`. In test runs 4 of 6 detail pages were read.
- `videoUrl` and image links are signed by TikTok and expire after a few hours. Download them right after the run if you need the files. Some ads show no creative in the library (`videoUrl` empty).
- Dates are days (UTC), as the library shows them. `reachRange` is TikTok's bucket; most ads in the library are in "0-1K".
- The library covers the EU, EEA, Switzerland, the UK, Turkey and Brazil only. Sorting by publication date is not offered because the library page does not run that search from a link.
- An advertiser name searches the library by text, so ads that only mention the name are filtered out by Strict advertiser match. For one exact advertiser use its `advertiserAdsUrl`.

### FAQ

**Does it need a TikTok account or cookies?** No. The Ad Library is public.

**Where do I find an advertiser's exact link?** Run a search with `includeDetails: true` and copy `advertiserAdsUrl`, or open an ad on library.tiktok.com, click the advertiser and copy the address bar.

**Why did a search return nothing?** Either the library has no ad for it (`RUN_SUMMARY` lists it in `adLibrary.emptySearches`) or TikTok refused every page (`RUN_SUMMARY` says `blocked`).

### Related actors

- [Facebook Ads Library Scraper](https://apify.com/datahamster/facebook-ads-library-scraper): the same brands' ads on Facebook and Instagram.
- [LinkedIn Ad Library Scraper](https://apify.com/datahamster/linkedin-ad-library-scraper): their B2B ads on LinkedIn.
- [Google Ads Transparency Scraper](https://apify.com/datahamster/google-ads-transparency): their Google search, display and YouTube ads.
- [TikTok Video Scraper](https://apify.com/datahamster/tiktok-video-scraper): views, likes and comments of TikTok videos.

### Changelog

- 0.1: first release. Keywords, advertiser names, pasted Ad Library links, regions and dates; dedupe across searches; date splitting past the 84-ad limit; numeric reach and impressions; optional detail pages with regions and targeting; monitor mode for new ads.

# Actor input Schema

## `keywords` (type: `array`):

Words to search in the Ad Library, one per line, e.g. "nike", "black friday". Put a phrase in double quotes for an exact match. Each keyword is one search (per region).

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

Advertiser names as the Ad Library shows them ("Snipes SE"), one per line. With Strict advertiser match on, only ads whose advertiser name contains the name are kept. For one exact advertiser, paste its Ad Library link into Ad Library search URLs.

## `searchUrls` (type: `array`):

Search links copied from library.tiktok.com/ads, one per line, e.g. an advertiser's "all ads" link (adv_name + adv_biz_ids, exact advertiser) or a search with the site's own filters (region, dates, sort, reach, age, gender, status). Each link is one search; its region, dates and filters are kept. advertiserAdsUrl in the results is such a link.

## `regions` (type: `array`):

Two-letter codes of the regions the Ad Library covers: AT, BE, BG, BR, CH, CY, CZ, DE, DK, EE, ES, FI, FR, GB, GR, HR, HU, IE, IS, IT, LI, LT, LU, LV, MT, NL, NO, PL, PT, RO, SE, SI, SK, TR. Each region is a separate search. Empty = all regions in one search.

## `lastDays` (type: `integer`):

Ads shown in the last N days (UTC), used when Start date is empty. In monitor mode the window moves with every run.

## `startDate` (type: `string`):

YYYY-MM-DD. Ads shown on or after this day. Overrides Last N days.

## `endDate` (type: `string`):

YYYY-MM-DD. Ads shown on or before this day. Empty = today.

## `sortBy` (type: `string`):

The Ad Library's own sort.

## `includeDetails` (type: `boolean`):

Open each ad's detail page and add advertiser business id and country, paid-for-by, objective, the regions the ad ran in with impressions per region (numeric too), total impressions and the targeting summary (ages, genders, audience size, interest and audience flags). About 6 seconds per ad, so slower. No extra event.

## `maxAdsPerSearch` (type: `integer`):

Stop each keyword, advertiser and region search after this many new ads, so one broad search cannot use up Max items.

## `splitDateRange` (type: `boolean`):

The Ad Library shows at most 84 ads per search. When a search hits that limit, search the newer and the older half of the date range again (and so on, down to single days) until Max ads per search is reached. Scrape mode only.

## `strictAdvertiserMatch` (type: `boolean`):

For advertiser names: keep only ads whose advertiser name contains the name you typed (case-insensitive). Off = every ad the Ad Library search returns for that name.

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

Stop after this many results (you are charged only for pushed items)

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

scrape = full results; monitor = only new/changed items since the previous run of this task

## `monitorStateId` (type: `string`):

Optional state id when not running as a saved task (monitor mode)

## `webhookUrl` (type: `string`):

POST a change summary here in monitor mode

## `telegramBotToken` (type: `string`):

Optional: bot token for monitor-mode change summaries

## `telegramChatId` (type: `string`):

Optional: chat id that receives monitor-mode summaries

## Actor input object example

```json
{
  "keywords": [
    "nike"
  ],
  "regions": [
    "DE"
  ],
  "lastDays": 30,
  "sortBy": "last_shown_date,desc",
  "includeDetails": false,
  "maxAdsPerSearch": 12,
  "splitDateRange": true,
  "strictAdvertiserMatch": true,
  "maxItems": 12,
  "mode": "scrape"
}
```

# Actor output Schema

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

All pushed rows (dataset, JSON)

## `resultsTable` (type: `string`):

Dataset in the Console viewer

## `runSummary` (type: `string`):

RUN_SUMMARY record

# 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 = {
    "keywords": [
        "nike"
    ],
    "regions": [
        "DE"
    ],
    "maxAdsPerSearch": 12,
    "maxItems": 12
};

// Run the Actor and wait for it to finish
const run = await client.actor("datahamster/tiktok-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 = {
    "keywords": ["nike"],
    "regions": ["DE"],
    "maxAdsPerSearch": 12,
    "maxItems": 12,
}

# Run the Actor and wait for it to finish
run = client.actor("datahamster/tiktok-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 '{
  "keywords": [
    "nike"
  ],
  "regions": [
    "DE"
  ],
  "maxAdsPerSearch": 12,
  "maxItems": 12
}' |
apify call datahamster/tiktok-ads-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,datahamster/tiktok-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/398T6Kh2CGdTeagw8/builds/w1eGm0S0pjfcBptIF/openapi.json
