# TikTok Viral Video & Competitor Analyzer (`scravion/tiktok-viral-video-competitor-analyzer`) Actor

Find TikTok breakout videos, compare posts against each creator's normal performance, inspect velocity, engagement, creative patterns, data quality, and competitor winners.

- **URL**: https://apify.com/scravion/tiktok-viral-video-competitor-analyzer.md
- **Developed by:** [scravion](https://apify.com/scravion) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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 Viral Video & Competitor Analyzer

### Find the TikTok videos that are exceptional **for that creator**

Raw views alone are a weak competitor signal. A 500K-view post can be ordinary for one creator and a major breakout for another. This Actor focuses on **creator-normalized performance** using public TikTok data available at run time.

If a creator's usable recent-video median is **50,000 views** and one public video has **750,000 views**, the **Creator View Multiplier is 15x**.

That creator-relative multiplier is the product's primary ranking signal.

### 🔥 Breakout Finder

When enough public creator-video view counts are available, the Actor calculates:

- `creatorMedianViews`
- `creatorAverageViews`
- `creatorViewMultiplier = videoViews / creatorMedianViews`
- `creatorAverageViewMultiplier = videoViews / creatorAverageViews`
- `baselineSampleSize`

The default minimum baseline is **5 usable videos**. Below that threshold, creator-normalized fields remain `null` instead of pretending that one or two videos represent normal account performance.

### 🧠 TikTok Breakout Score

`breakoutScore` is a **transparent descriptive score (0–100)**. It is not an official TikTok metric and not a prediction of future virality.

Nominal component weights:

| Component | Weight |
|---|---:|
| Creator View Multiplier | 50% |
| Views per day | 25% |
| Engagement rate | 20% |
| Recency | 5% |

The Actor exposes:

- `breakoutScore`
- `breakoutScoreCoverage`
- `analysis.breakoutScoreMissingComponents`
- `analysis.breakoutScoreComponents`

If optional inputs are missing, available weights are re-normalized. If `creatorViewMultiplier` is unavailable, the Breakout Score stays `null`.

### 🧪 Data Quality

Every video includes a metric-coverage check so users can distinguish strong analysis from sparse public data:

- `dataQualityPercent`
- `dataQualityLabel` (`high`, `medium`, `low`)
- `resultStatus` (`complete`, `partial`)
- `sourceStatus`
- `sourceProvider`

This is especially important because TikTok can expose different public fields across pages, regions, and time.

### ⚡ Velocity

When the public publish timestamp is available:

- `videoAgeHours`
- `videoAgeDays`
- `viewsPerHour`
- `viewsPerDay`
- `likesPerDay`
- `commentsPerDay`
- `sharesPerDay`

Missing timestamps or counts remain `null`.

### 💬 Engagement Intelligence

When public counts are available:

- `engagementRate`
- `likeRate`
- `commentRate`
- `shareRate`

Missing engagement components are **not treated as zero**. The combined engagement rate only uses counts that were actually available.

### 🎬 Creative Intelligence

No OpenAI or Claude key is required. Caption analysis is deterministic and can extract:

- hashtags and mentions
- caption length
- first-line hook
- question hook
- number/list hook
- CTA words
- emoji density
- detected keywords
- hook type

### 🧩 Winning Pattern Summary

For creators with enough analyzable videos, `CREATOR_SUMMARIES` includes evidence-backed pattern output such as:

- recurring hashtags among top breakout posts
- recurring keywords
- top-cohort duration median
- hook-type median multipliers
- best outlier videos
- best engagement videos
- fastest-growing videos

Pattern statements are only emitted when minimum sample/evidence rules are met.

### 🏆 Competitor Mode

Add multiple creators in one run. Each creator gets their own baseline, then all unique accepted videos can be sorted together.

This lets you answer a more useful question than “who has the most raw views?”:

> Which competitor video most strongly outperformed that creator's own normal performance?

### ⚡ Quick Start

1. Add one or more values to **TikTok accounts or URLs**.
2. Leave **Videos to analyze per creator** at `30` for a normal audit.
3. Keep **Calculate Breakout Score** enabled.
4. Keep **Sort results by → Creator outlier multiplier** for breakout discovery.
5. Start the Actor and open **🔥 Viral / Breakout Finder**.

Accepted inputs:

- `@username`
- `username`
- public TikTok creator URL
- public TikTok video URL
- TikTok `vm.` / `vt.` short link

There are no public sample creators in the default input.

### 📊 Dataset Views

- 🔥 Viral / Breakout Finder
- ⚡ Fastest Growing
- 🏆 Competitor Winners
- 💬 Engagement Winners
- 🎬 Creative Insights
- 🧪 Data Quality
- Full / Technical

The selected `Sort by` input controls the order in which primary rows are stored. Dataset views focus the columns for different workflows.

### 📦 Output Contract

Primary Dataset rows contain both nested API-friendly objects and flat spreadsheet-friendly fields:

```json
{
  "type": "video",
  "platform": "tiktok",
  "videoId": "...",
  "videoUrl": "...",
  "creator": {
    "username": "creator",
    "displayName": "Creator",
    "followers": 123456
  },
  "metrics": {
    "views": 500000,
    "likes": 40000,
    "comments": 1500,
    "shares": 4200
  },
  "benchmark": {
    "baselineSampleSize": 30,
    "creatorMedianViews": 45000,
    "creatorViewMultiplier": 11.11
  },
  "velocity": {
    "videoAgeHours": 18,
    "viewsPerHour": 27777.7
  },
  "analysis": {
    "breakoutScore": 92,
    "breakoutScoreCoverage": 1.0,
    "performanceLabel": "High Outlier"
  },
  "dataQuality": {
    "coveragePercent": 100,
    "quality": "high"
  },
  "resultStatus": "complete"
}
```

Missing values are `null`. Values are never invented to fill gaps.

### 🔄 Reliability

- 429 / selected 5xx / network timeouts use exponential backoff with jitter.
- Sources are isolated: one failed creator does not cancel the run.
- Multiple sources are processed concurrently within the configured request limit.
- TikTok video ID is the stable dedupe key.
- Duplicate, failed, and invalid records do not consume `maxItems`.
- Invalid TikTok hosts and non-HTTP(S) URLs are rejected.
- Tracking query strings/fragments are removed from accepted TikTok URLs.
- Errors are stored separately in the `tiktok-errors` Dataset.
- `RUN_SUMMARY` records source/runtime/selection statistics.

### 💾 Export & Automation

Use Apify's normal Dataset export/API options for JSON, CSV, Excel, XML, and integrations. `RUN_SUMMARY` and `CREATOR_SUMMARIES` are stored in the default key-value store.

The code is structured so a future pay-per-event boundary can charge only **unique accepted primary video results**. Pricing is intentionally not hard-coded in this source package.

### Important Limitations

- Public TikTok data only.
- No login bypass, CAPTCHA bypass, private-profile bypass, stolen cookies, session theft, or authentication circumvention.
- The default path uses public pages/embedded page JSON and official TikTok oEmbed as a direct-video fallback.
- Official oEmbed identifies public videos/profiles but does not provide the performance-count set required for creator baselines; metric fields therefore remain `null` when oEmbed is the only available source.
- TikTok can change public page structures. A creator can therefore become `partial` or `unavailable` without the Actor inventing data.
- No sponsorship/deal-value estimate is generated.
- No ROI estimate is generated.
- No “viral probability” or future-performance prediction is generated.

### Verification

The repository includes deterministic unit tests plus an offline end-to-end creator fixture. The Docker build runs the test suite after installing dependencies, so regressions fail the build instead of silently publishing.

See `ACCEPTANCE_REPORT.md` and `docs/IMPLEMENTATION.md` for technical verification details.

# Changelog

This Actor's version history is a separate document: https://apify.com/scravion/tiktok-viral-video-competitor-analyzer/changelog.md

# Actor input Schema

## `targets` (type: `array`):

Add @username, username, a public TikTok profile URL, public video URL, or TikTok short link. Add multiple creators to compare competitors.

## `videosToAnalyze` (type: `integer`):

Maximum recent public videos used for creator baselines and breakout analysis.

## `calculateBreakoutScore` (type: `boolean`):

Calculate a transparent 0–100 descriptive score from available public performance metrics. This is not a virality prediction.

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

Primary ordering applied before maxItems is stored.

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

Maximum unique accepted primary videos across all inputs. Duplicates and failures do not consume this limit.

## `minBaselineVideos` (type: `integer`):

Creator median/average and outlier multiplier remain null until this many videos have usable view counts.

## `includeProfile` (type: `boolean`):

Include follower/following/total-like fields when public page data exposes them.

## `includeEngagementMetrics` (type: `boolean`):

Calculate engagement, like, comment, and share rates when counts are public.

## `includeCreativeAnalysis` (type: `boolean`):

Deterministic hashtag, mention, hook, CTA, emoji, and keyword analysis. No AI API key required.

## `timeout` (type: `integer`):

Per-request timeout for public TikTok pages and official oEmbed fallback.

## `concurrency` (type: `integer`):

Maximum simultaneous public HTTP requests. Keep conservative to reduce rate-limit risk.

## Actor input object example

```json
{
  "targets": [],
  "videosToAnalyze": 30,
  "calculateBreakoutScore": true,
  "sortBy": "creatorViewMultiplier",
  "maxItems": 30,
  "minBaselineVideos": 5,
  "includeProfile": true,
  "includeEngagementMetrics": true,
  "includeCreativeAnalysis": true,
  "timeout": 25,
  "concurrency": 6
}
```

# Actor output Schema

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

No description

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

No description

## `creatorSummaries` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("scravion/tiktok-viral-video-competitor-analyzer").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("scravion/tiktok-viral-video-competitor-analyzer").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 scravion/tiktok-viral-video-competitor-analyzer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scravion/tiktok-viral-video-competitor-analyzer"
        }
    }
}
```

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/cZziETe93ntTDlDXt/builds/Cfb2NRCAb8oxa7JnR/openapi.json
