# TikTok Scraper (`barz.f.hussein/tiktok-scraper`) Actor

TikTok Ads Library & Competitor Ad Scraper. Search TikTok advertisements, discover competitors, extract commercial advertising data, creative references, and export organized datasets for research and analysis.

- **URL**: https://apify.com/barz.f.hussein/tiktok-scraper.md
- **Developed by:** [Barz F Hussein](https://apify.com/barz.f.hussein) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

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

> **TikTok Ads Library & Competitor Ad Scraper**\
> *Official Commercial Content API integration for European Economic Area (EEA) ad transparency and competitor advertising research.*

***

### Introduction

**TikTok Scraper** helps advertisers, agencies, and researchers discover TikTok advertisements and public commercial content. Search by keyword, advertiser, country, and date range, then export structured advertisement data, creative references, advertiser information, reach data, and available targeting details.

Unlike fragile browser scrapers that break when TikTok updates its web interface, **TikTok Scraper** queries the official **TikTok Commercial Content API** (part of TikTok's European Economic Area ad transparency and Digital Services Act compliance tooling). This provides reliable, structured, and rate-limit-aware access to public ad campaigns, advertiser business IDs, creative media URLs, and audience targeting parameters.

> **Mandatory Compliance & Access Notice:**
>
> - **API Approval Requirement:** Access requires an approved TikTok Developer account with the **Commercial Content API** (`research.adlib.basic`) scope enabled.
> - **Commercial Monetization Gate:** Commercial monetization, Pay Per Event (PPE) billing, and commercial dataset redistribution are **strictly locked** pending verified written authorization from TikTok confirming that the intended Apify distribution and customer usage are permitted. The Actor operates in authorized private developer/research mode by default.
> - **Geographic Coverage:** Advertising data coverage is strictly limited to European Economic Area (EEA) member states as mandated by European transparency regulations. The United Kingdom and Switzerland are excluded per official TikTok documentation.

***

### Key Features

- **Official Commercial Content API Integration:** Built directly on TikTok's official REST API endpoints, ensuring high reliability, stability, and zero risk of IP blocking.
- **Mandatory Compliance Gate:** Enforces platform terms of service and prevents unauthorized commercial billing until written authorization is verified.
- **Competitor Ad Keyword Search:** Search advertisements using keywords or phrases with both fuzzy and exact match modes (up to 10 ads per API request).
- **Advertiser Discovery:** Uncover brand accounts and retrieve verified TikTok advertiser business IDs and country registrations (direct query up to 50 advertisers per request).
- **Controlled Ad Details Extraction:** Fetch full creative assets, objectives, call-to-action buttons, and landing page URLs for specific ad IDs using strictly one `ad_id` per request with controlled sequential rate-pacing.
- **Creator Commercial Content Discovery:** Search public branded and sponsored creator content labeled under TikTok's commercial disclosure rules (up to 50 posts per request).
- **Geographic Scope (EEA):** Filter ad and commercial content searches across 30 European Economic Area (EEA) member countries.
- **Date Filtering:** Query historical campaigns with date windows up to 365 days dating back to October 1, 2022.
- **Ad Format & Status Filtering:** Filter by creative type (`VIDEO` or `IMAGE`) and delivery status (`ACTIVE` or `INACTIVE`).
- **Observed Longevity Intelligence:** Automatically calculate active campaign duration in calendar days between first shown and last shown dates to evaluate creative longevity signals.
- **Targeting & Audience Data:** Extract authorized targeting criteria, including age brackets, gender distributions, and target countries.
- **Audience Reach Intervals:** Extract official reach intervals (`0-10K`, `10K-100K`, `100K+`) without fabricating fake impression numbers.
- **Lossless 64-bit ID Handling:** Custom pre-parse JSON stream transformation guarantees zero IEEE-754 precision loss on 64-bit numeric IDs.
- **Enterprise Deduplication:** Deduplicates ads strictly by unique `ad.id`—preserving different creative campaigns from the same advertiser.
- **Zero-Secret Logging:** Complete redaction of API keys, client secrets, and Bearer tokens across all logs, error traces, and dataset outputs.
- **Multi-Format Export:** Export clean datasets to JSON, CSV, or Excel directly via the Apify platform.

***

### Primary Use Cases

1. **Competitor Advertising Intelligence:** Monitor what competitors are testing in European markets, how long their ads remain active, and what angles they emphasize.
2. **TikTok Creative Research:** Discover high-longevity video creatives and hook concepts across specific e-commerce and SaaS niches.
3. **Advertiser Brand Audits:** Identify all active advertisements run by a specific business ID or brand name.
4. **Media Buying & Market Expansion:** Research which European countries competitors target before launching international campaigns.
5. **Creative Strategy & Ad Copy Benchmarking:** Compare headline hooks, call-to-action choices, and destination landing pages across top advertisers.
6. **Regulatory Compliance & Transparency Research:** Analyze advertising frequency, demographic targeting patterns, and disclosure labels for academic or institutional research.

***

### How to Use

1. **Obtain TikTok Developer Credentials:** Log in to [TikTok for Developers](https://developers.tiktok.com/) and ensure your project has been approved for the Commercial Content API.
2. **Open TikTok Scraper on Apify:** In the Actor input form, paste your `tiktokClientKey` and `tiktokClientSecret`. (These fields are encrypted and secret).
3. **Select an Operation:**
   - `search_ads` — Search paid advertisements (Primary, max 10/request)
   - `search_advertisers` — Search advertiser brands and business IDs (Direct query, max 50/request)
   - `get_ad_details` — Retrieve detailed metadata for specific ad IDs (Controlled sequential retrieval)
   - `search_commercial_content` — Query creator sponsored posts (Max 50/request)
   - `ad_reports` — Retrieve publishing volume time-series reports by country
4. **Configure Search Parameters:** Enter your target search keywords (e.g., `["fitness supplements"]`) and select EEA country codes (e.g., `["DE", "FR"]`).
5. **Set Date Range:** Define `dateFrom` and `dateTo` (e.g., `2024-01-01` to `2024-06-01`, maximum window 365 days).
6. **Set Maximum Results:** Specify the maximum number of records to retrieve (default: `100`).
7. **Start the Actor:** Click **Start**. The Actor will authenticate, validate the compliance gate, query the official endpoints, normalize records losslessly, and write them to the Apify dataset.
8. **Export Your Data:** Download the extracted dataset in JSON, CSV, or Excel format.

***

### Input Examples

#### Example 1: Search Ads by Keyword (Primary)

```json
{
  "operation": "search_ads",
  "tiktokClientKey": "your_client_key",
  "tiktokClientSecret": "your_client_secret",
  "searchTerms": ["collagen peptides"],
  "searchType": "fuzzy_phrase",
  "countryCodes": ["DE", "AT"],
  "dateFrom": "2024-01-01",
  "dateTo": "2024-06-01",
  "adStatus": "ACTIVE",
  "adType": "VIDEO",
  "maxResults": 100,
  "includeAdDetails": false
}
```

#### Example 2: Search Ads by Multiple Keywords with Ad Detail Enrichment

```json
{
  "operation": "search_ads",
  "tiktokClientKey": "your_client_key",
  "tiktokClientSecret": "your_client_secret",
  "searchTerms": ["protein powder", "creatine monohydrate"],
  "countryCodes": ["FR"],
  "dateFrom": "2024-01-15",
  "dateTo": "2024-04-15",
  "adStatus": "ALL",
  "maxResults": 100,
  "includeAdDetails": true
}
```

#### Example 3: Search Advertisers by Brand Name (Direct Single Query)

```json
{
  "operation": "search_advertisers",
  "tiktokClientKey": "your_client_key",
  "tiktokClientSecret": "your_client_secret",
  "searchTerms": ["Gymshark"],
  "maxResults": 50
}
```

#### Example 4: Get Detailed Metadata for Specific Ad IDs (Sequential)

```json
{
  "operation": "get_ad_details",
  "tiktokClientKey": "your_client_key",
  "tiktokClientSecret": "your_client_secret",
  "adIds": ["1048365937726458", "1048365937726459"],
  "maxResults": 10
}
```

#### Example 5: Search Creator Commercial Content (Sponsored Posts)

```json
{
  "operation": "search_commercial_content",
  "tiktokClientKey": "your_client_key",
  "tiktokClientSecret": "your_client_secret",
  "searchTerms": ["sponsored"],
  "countryCodes": ["DE"],
  "dateFrom": "2024-01-01",
  "dateTo": "2024-05-01",
  "maxResults": 50
}
```

#### Example 6: Generate Country Time-Series Ad Publishing Report

```json
{
  "operation": "ad_reports",
  "tiktokClientKey": "your_client_key",
  "tiktokClientSecret": "your_client_secret",
  "countryCodes": ["DE"],
  "dateFrom": "2024-01-01",
  "dateTo": "2024-01-31"
}
```

***

### Output Data Schema

Every record written to the dataset includes a `recordType` field distinguishing paid ads, advertisers, commercial content, and reports:

#### Field Reference Table

| Field Path | Data Type | Description | Source | Possible Missing Values |
| :--- | :--- | :--- | :--- | :--- |
| `recordType` | `string` | Type of record (`paid_ad`, `advertiser`, `commercial_content`, `advertising_report`) | System Normalizer | Always present |
| `ad.id` | `string` | Unique 64-bit advertisement identifier (lossless string preservation) | TikTok Ad Library | Present on `paid_ad` |
| `ad.title` | `string \| null` | Headline or creative caption of the advertisement | TikTok Ad Library | `null` if omitted by advertiser |
| `ad.firstShownDate` | `string \| null` | Earliest observed publication date (ISO `YYYY-MM-DD`) | TikTok Ad Library | `null` if unavailable |
| `ad.lastShownDate` | `string \| null` | Most recent observed publication date (ISO `YYYY-MM-DD`) | TikTok Ad Library | `null` if unavailable |
| `ad.status` | `string \| null` | Current delivery status (`ACTIVE`, `INACTIVE`) | TikTok Ad Library | `null` if omitted |
| `ad.videoUrls` | `string[]` | Direct media URLs for video creative assets | TikTok Ad Library | Empty array `[]` if image ad |
| `ad.imageUrls` | `string[]` | Image slide or video thumbnail URLs | TikTok Ad Library | Empty array `[]` if none |
| `ad.externalUrl` | `string \| null` | Destination landing page URL | Ad Details API | `null` if query only |
| `ad.callToAction` | `string \| null` | Action button text (e.g. `Shop Now`, `Learn More`) | Ad Details API | `null` if not specified |
| `ad.advertisingObjective`| `string \| null` | Optimization objective (e.g. `CONVERSIONS`, `TRAFFIC`) | Ad Details API | `null` if not available |
| `ad.reach.raw` | `string \| null` | Official audience reach bracket (e.g. `10K-100K`, `100K+`) | TikTok Ad Library | `null` if pending audit |
| `advertiser.businessId` | `string \| null` | Unique advertiser account identifier (lossless string preservation) | TikTok Ad Library | `null` if missing |
| `advertiser.businessName` | `string \| null` | Registered legal or trade name of the advertiser | TikTok Ad Library | `null` if unlisted |
| `advertiser.paidForBy` | `string \| null` | Legal entity or agency funding the advertisement | TikTok Ad Library | `null` if same as brand |
| `advertiser.countryCode` | `string \| null` | Registered corporate country code of the advertiser | TikTok Ad Library | `null` if undisclosed |
| `targeting.ageGroups` | `string[]` | Target audience age brackets (e.g. `["18-24", "25-34"]`) | Ad Group Targeting | Empty array `[]` |
| `targeting.gender` | `string \| null` | Gender targeting filter (`MALE`, `FEMALE`, or `null`) | Ad Group Targeting | `null` if unsegmented |
| `targeting.countries` | `string[]` | Target delivery country codes | Ad Group Targeting | Array of country codes |
| `intelligence.observedSpanDays`| `number \| null` | Active running duration in calendar days | Intelligence Engine | `null` if dates missing |
| `intelligence.hasVideoCreative`| `boolean` | Flag indicating presence of video creative assets | Intelligence Engine | `true` or `false` |
| `intelligence.hasImageCreative`| `boolean` | Flag indicating presence of static image creative assets | Intelligence Engine | `true` or `false` |
| `intelligence.longevitySignalNote`| `string` | Fact-based explanatory signal note with disclaimer | Intelligence Engine | Descriptive text string |
| `report.publishedAdsCount` | `number` | Count of published ads for country/date time-series | Ad Report API | Present on `advertising_report` |
| `report.timeSeriesMetric` | `string` | Metric name (`count_time_series_by_country`) | Ad Report API | Present on `advertising_report` |
| `report.description` | `string` | Delineates publishing time-series from ad metrics | System Normalizer | Present on `advertising_report` |
| `searchContext.keyword` | `string \| null` | Query keyword that discovered this record | Execution Context | `null` if advertiser query |
| `searchContext.countryCodes` | `string[]` | Targeted country codes in query | Execution Context | Array of country codes |
| `source.provider` | `string` | Data source provider (`TikTok Commercial Content API`) | Provenance Engine | Always present |
| `source.endpoint` | `string` | Specific API endpoint called | Provenance Engine | Always present |
| `source.retrievedAt` | `string` | ISO-8601 UTC timestamp of data retrieval | Provenance Engine | Always present |

***

#### Illustrative JSON Record Example

*(The following is a formatted structural example illustrating normalized output):*

```json
{
  "recordType": "paid_ad",
  "ad": {
    "id": "1048365937726458",
    "title": "Premium Plant-Based Protein Shake",
    "firstShownDate": "2024-01-15",
    "lastShownDate": "2024-03-20",
    "status": "ACTIVE",
    "statusStatement": "Complies with advertising standards",
    "videoUrls": [
      "https://v16.tiktokcdn.com/commercial/video/sample.mp4"
    ],
    "imageUrls": [
      "https://p16.tiktokcdn.com/commercial/img/sample.jpeg"
    ],
    "externalUrl": "https://example.com/protein-shake",
    "callToAction": "Shop Now",
    "advertisingObjective": "CONVERSIONS",
    "reach": {
      "raw": "100K+",
      "value": null
    }
  },
  "advertiser": {
    "businessId": "984729184729184",
    "businessName": "FitLife Global Nutrition",
    "paidForBy": "FitLife Global Ltd",
    "countryCode": "DE",
    "followerCount": 125000,
    "profileUrl": "https://www.tiktok.com/@fitlifeglobal",
    "avatarUrl": "https://p16.tiktokcdn.com/commercial/avatar/fitlife.jpeg"
  },
  "targeting": {
    "ageGroups": ["18-24", "25-34"],
    "gender": "MALE, FEMALE",
    "countries": ["DE", "AT"],
    "raw": {
      "country": ["DE", "AT"],
      "age": ["18-24", "25-34"]
    }
  },
  "intelligence": {
    "observedSpanDays": 66,
    "activeStatus": "ACTIVE",
    "hasVideoCreative": true,
    "hasImageCreative": true,
    "creativeCount": 2,
    "longevitySignalNote": "Long-running ad creative: Observed active in the ad library for 66 days. Observed creative longevity indicates the verified calendar span between first and last publication dates in the TikTok Ad Library. It reflects how long the creative was actively kept in circulation, but should not be construed as proof of financial profitability or advertiser return on ad spend (ROAS)."
  },
  "searchContext": {
    "keyword": "protein",
    "countryCodes": ["DE"],
    "dateFrom": "2024-01-01",
    "dateTo": "2024-05-01"
  },
  "source": {
    "provider": "TikTok Commercial Content API",
    "endpoint": "ad/query",
    "retrievedAt": "2024-03-20T14:30:00.000Z"
  }
}
```

***

### API Access & Commercial Authorization

To run this Actor against live TikTok advertising data, you must provide valid credentials from an approved TikTok for Developers application.

#### Developer Setup Steps

1. **Register Developer Account:** Navigate to [TikTok for Developers](https://developers.tiktok.com/) and register or log in.
2. **Apply for Commercial Content API:** Submit an application for the **Commercial Content API** under European Union / EEA transparency and Research tools.
3. **Obtain Project Credentials:** Once approved, copy your **Client Key** and **Client Secret** from your project settings.
4. **Enter Credentials in Actor:** Paste credentials into the `tiktokClientKey` and `tiktokClientSecret` input fields.
5. **Commercial Distribution Notice:** By default, the Actor operates under authorized private developer and research testing. Enabling commercial monetization, Pay Per Event billing, or public dataset redistribution requires explicit written authorization from TikTok.

***

### Geographic Scope & Regulatory Boundaries

#### Supported Countries (EEA Member States)

Queries are supported across **30 European Economic Area (EEA)** countries:

- Austria (`AT`), Belgium (`BE`), Bulgaria (`BG`), Croatia (`HR`), Cyprus (`CY`), Czech Republic (`CZ`), Denmark (`DK`), Estonia (`EE`), Finland (`FI`), France (`FR`), Germany (`DE`), Greece (`GR`), Hungary (`HU`), Iceland (`IS`), Ireland (`IE`), Italy (`IT`), Latvia (`LV`), Liechtenstein (`LI`), Lithuania (`LT`), Luxembourg (`LU`), Malta (`MT`), Netherlands (`NL`), Norway (`NO`), Poland (`PL`), Portugal (`PT`), Romania (`RO`), Slovakia (`SK`), Slovenia (`SI`), Spain (`ES`), Sweden (`SE`).

#### Excluded Countries

- **United Kingdom (`GB` / `UK`)** and **Switzerland (`CH`)** are explicitly excluded from the Commercial Content API per official TikTok documentation.
- Non-European countries (e.g. `US`, `CA`, `AU`) are not covered by this ad library transparency endpoint.

*Note on Advertiser Country Code:* While ad publishing searches require supported EEA target countries, an advertiser's corporate legal registration (`advertiser.countryCode`) can be global (e.g. `US`, `CA`, `CN`) and is preserved as returned.

***

### Pricing & Monetization Notice

- **Current Status:** Commercial monetization and Pay Per Event (PPE) charges are **strictly disabled** in compliance with the TikTok Commercial Content API terms.
- **Commercial Deployment Requirement:** Written authorization from TikTok confirming the permitted distribution model is required prior to introducing any commercial fee or PPE tier.
- **Fair Use:** Under private research use, no usage fees or event charges apply.

***

### Limitations

1. **Official API Eligibility:** This Actor relies solely on the official TikTok Commercial Content API. It requires an approved developer project and cannot run anonymously.
2. **Endpoint Maximum Page Limits:**
   - Ad search: maximum 10 ads per request.
   - Advertiser search: direct query, maximum 50 advertisers per request (no cursor pagination documented).
   - Commercial content search: maximum 50 posts per request.
3. **Audience Reach as Brackets:** TikTok reports reach as bucketed intervals (`0-10K`, `10K-100K`, `100K+`). Exact impression counts are not provided by TikTok and are not fabricated by this Actor.
4. **Publishing Time-Series:** The ad report endpoint provides aggregate volume of published ads per day per country; it does not provide individual ad impressions, click-through rates (CTR), or ad spend.
5. **Creative File Downloads:** High-resolution CDN URLs are extracted rather than downloading raw video files.
6. **Date Constraints:** The API enforces a 365-day maximum query window, and historical ad library data begins on October 1, 2022.

***

### Frequently Asked Questions (FAQ)

##### What is TikTok Scraper?

TikTok Scraper is a compliant Apify Actor designed to search, extract, and analyze commercial advertisements and sponsored creator content from the official TikTok Ad Library.

##### Do I need a TikTok developer account?

Yes. It integrates directly with the official TikTok Commercial Content API, requiring a registered TikTok for Developers account.

##### Do I need API approval?

Yes. Your project must have approved access to the Commercial Content / Ad Library API (`research.adlib.basic` scope).

##### Can I search competitor advertisements?

Yes. You can search by keywords in the ad copy, filter by publication date range, filter by active or inactive status, or target specific advertiser business IDs.

##### How does advertiser search work?

The official advertiser search endpoint returns up to 50 matching advertisers for a keyword in a single direct response. The Actor does not attempt unsupported cursor pagination on this endpoint.

##### How does ad details retrieval work?

The ad details endpoint accepts strictly one `ad_id` per request. When multiple IDs are requested, the Actor executes controlled sequential retrieval with polite rate-pacing.

##### Does the report operation return impressions or ad spend?

No. TikTok's commercial content reporting endpoint returns aggregate time-series counts of published advertisements per country. It does not provide individual campaign spend, impressions, CTR, or ROAS.

##### Can I search in the United States or the UK?

No. TikTok's Commercial Content API is specifically tied to the European Economic Area (EEA) transparency framework. The UK, Switzerland, and the United States are not covered by this endpoint.

##### How are duplicates handled?

Advertisements are deduplicated strictly by their unique 64-bit `ad.id`. If an advertiser runs multiple separate advertisements, all distinct ads are preserved. Advertisers in the advertiser search operation are deduplicated by `business_id`.

##### Does the Actor download video files?

No. It extracts verified CDN video URLs and cover image links, allowing you to preview or stream creatives on demand without consuming excessive disk space.
LETS MAKE DATA MORE USEFULL :)

# Actor input Schema

## `operation` (type: `string`):

Select the authorized TikTok Commercial Content API operation to execute.

## `tiktokClientKey` (type: `string`):

Client Key from your approved TikTok Commercial Content / Research API application.

## `tiktokClientSecret` (type: `string`):

Client Secret from your approved TikTok Commercial Content / Research API application.

## `tiktokWrittenAuthorizationCode` (type: `string`):

Mandatory written authorization token from TikTok confirming permitted commercial distribution. Required only to unlock commercial mode; leave empty for private developer/research runs.

## `commercialMonetizationRequested` (type: `boolean`):

If enabled, asserts that written commercial authorization from TikTok is verified before proceeding.

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

Keywords or search phrases to query. For advertiser queries, max keyword length is 50 characters.

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

Keyword matching mode: 'fuzzy_phrase' matches any or all words in any order; 'exact_phrase' requires exact string match.

## `countryCodes` (type: `array`):

Supported European Economic Area (EEA) country codes where ads were published (e.g. DE, FR, IT). Non-EEA countries like UK and Switzerland are excluded per official TikTok documentation.

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

Start date for publication filter. Must be on or after 2022-10-01. Max window is 365 days.

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

End date for publication filter (YYYY-MM-DD).

## `adStatus` (type: `string`):

Filter ads by delivery status.

## `adType` (type: `string`):

Filter results by creative format.

## `advertiserBusinessIds` (type: `array`):

Specific advertiser business IDs to filter by. Ignored if searchTerms are provided in ad queries.

## `adIds` (type: `array`):

Required when operation is 'get_ad_details'. Array of ad ID strings or 64-bit integers.

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

Maximum number of records to retrieve across pagination.

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

When searching ads, sequentially retrieve detailed creative metadata for each discovered ad ID.

## `includeRawResponse` (type: `boolean`):

Include unmodified raw API response object in each extracted record for debugging.

## Actor input object example

```json
{
  "operation": "search_ads",
  "commercialMonetizationRequested": false,
  "searchTerms": [
    "fitness supplements"
  ],
  "searchType": "fuzzy_phrase",
  "countryCodes": [
    "DE"
  ],
  "dateFrom": "2024-01-01",
  "dateTo": "2024-06-01",
  "adStatus": "ACTIVE",
  "adType": "ALL",
  "advertiserBusinessIds": [],
  "adIds": [],
  "maxResults": 100,
  "includeAdDetails": false,
  "includeRawResponse": false
}
```

# Actor output Schema

## `dataset` (type: `string`):

Direct endpoint to access all extracted records in JSON format.

## `adsView` (type: `string`):

Direct dataset view filtered and transformed for paid advertisement intelligence, creative media URLs, and observed lifespans.

## `advertisersView` (type: `string`):

Direct dataset view formatted for discovered advertiser brand profiles and official business IDs.

## `commercialContentView` (type: `string`):

Direct dataset view formatted for creator sponsored and branded commercial content posts.

## `reportsView` (type: `string`):

Direct dataset view formatted for country aggregate daily ad publishing volume time-series.

## `datasetCsv` (type: `string`):

Direct download link to export dataset items as a clean, flattened CSV spreadsheet.

## `datasetXlsx` (type: `string`):

Direct download link to export dataset items as an Excel workbook.

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

Execution diagnostics, unique item counts, compliance gate verification status, and error logs stored in the default key-value store.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("barz.f.hussein/tiktok-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("barz.f.hussein/tiktok-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 '{}' |
apify call barz.f.hussein/tiktok-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,barz.f.hussein/tiktok-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/27kRpg3o1Uc24mhg0/builds/MYOv9ZakX9Kd9hym4/openapi.json
