# Viral Content Pattern Miner (`kayhermes/viral-content-pattern-miner`) Actor

- **URL**: https://apify.com/kayhermes/viral-content-pattern-miner.md
- **Developed by:** [Khoa Nguyen](https://apify.com/kayhermes) (community)
- **Categories:** Social media
- **Stats:** 3 total users, 2 monthly users, 96.3% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 post scoreds

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

## Viral Content Pattern Miner

Score supplied posts within platform cohorts and mine supported patterns across hooks, CTAs, duration, format, timing, hashtags, audio, caption length, and recurring keywords.

### What it actually does

Per-post viral scores plus pattern support, lift versus baseline, and average performance.

Supports inline JSON, an Apify Dataset, and public/signed JSON or CSV URLs. Source collection from social platforms is intentionally decoupled so users can connect any permitted scraper or export.

### Inputs

Use `posts[]`, `datasetId`, or `sourceUrls`. See `sample_input.json` and the Apify input schema for exact fields.

### Outputs

- Default Dataset: detailed result rows and a run summary
- `OUTPUT`: machine-readable run summary
- `REPORT.html`: reviewable HTML report

### Limitations

Pattern lift is descriptive, not proof of causation. Use adequate sample sizes and validate findings with new content. The Actor analyzes supplied data; it does not bypass platform access controls or guarantee that upstream data is complete.

### Local validation

```bash
npm ci
npm test
npm run check
npm start
```

### Deploy

```bash
apify login
apify push
```

Use `APIFY_TOKEN` from secure environment storage. Never commit credentials.

# Actor input Schema

## `posts` (type: `array`):

At least three posts; 20 or more is recommended. Include views, engagement metrics, text and content attributes.

## `datasetId` (type: `string`):

Provide Source Dataset ID.

## `sourceUrls` (type: `array`):

Provide CSV or JSON source URLs.

## `options` (type: `object`):

Control topPercent (5-50), minSupport, and minimumLift.

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

Provide Maximum posts.

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

Provide Completion webhook.

## Actor input object example

```json
{
  "posts": [
    {
      "postId": "p1",
      "platform": "tiktok",
      "creatorId": "creator-1",
      "publishedAt": "2026-07-01T14:00:00Z",
      "caption": "3 mistakes nobody tells you. Save this guide.",
      "hookText": "3 mistakes nobody tells you",
      "hashtags": [
        "growth",
        "tips"
      ],
      "durationSeconds": 18,
      "format": "talking-head",
      "audioName": "trend-audio",
      "followersAtPost": 10000,
      "views": 180000,
      "likes": 28000,
      "comments": 2200,
      "shares": 7000,
      "saves": 5000
    },
    {
      "postId": "p2",
      "platform": "tiktok",
      "creatorId": "creator-1",
      "publishedAt": "2026-07-02T14:00:00Z",
      "caption": "4 mistakes nobody tells you. Save this guide.",
      "hookText": "4 mistakes nobody tells you",
      "hashtags": [
        "growth",
        "tips"
      ],
      "durationSeconds": 18,
      "format": "talking-head",
      "audioName": "trend-audio",
      "followersAtPost": 10000,
      "views": 190000,
      "likes": 29000,
      "comments": 2200,
      "shares": 7000,
      "saves": 5000
    },
    {
      "postId": "p3",
      "platform": "tiktok",
      "creatorId": "creator-1",
      "publishedAt": "2026-07-03T14:00:00Z",
      "caption": "5 mistakes nobody tells you. Save this guide.",
      "hookText": "5 mistakes nobody tells you",
      "hashtags": [
        "growth",
        "tips"
      ],
      "durationSeconds": 18,
      "format": "talking-head",
      "audioName": "trend-audio",
      "followersAtPost": 10000,
      "views": 200000,
      "likes": 30000,
      "comments": 2200,
      "shares": 7000,
      "saves": 5000
    },
    {
      "postId": "p4",
      "platform": "tiktok",
      "creatorId": "creator-1",
      "publishedAt": "2026-07-04T14:00:00Z",
      "caption": "6 mistakes nobody tells you. Save this guide.",
      "hookText": "6 mistakes nobody tells you",
      "hashtags": [
        "growth",
        "tips"
      ],
      "durationSeconds": 18,
      "format": "talking-head",
      "audioName": "trend-audio",
      "followersAtPost": 10000,
      "views": 210000,
      "likes": 31000,
      "comments": 2200,
      "shares": 7000,
      "saves": 5000
    },
    {
      "postId": "p5",
      "platform": "tiktok",
      "creatorId": "creator-1",
      "publishedAt": "2026-07-05T14:00:00Z",
      "caption": "A normal day at work with a short update.",
      "hookText": "A normal day at work",
      "hashtags": [],
      "durationSeconds": 75,
      "format": "vlog",
      "audioName": "original",
      "followersAtPost": 10000,
      "views": 9000,
      "likes": 400,
      "comments": 20,
      "shares": 18,
      "saves": 10
    },
    {
      "postId": "p6",
      "platform": "tiktok",
      "creatorId": "creator-1",
      "publishedAt": "2026-07-06T14:00:00Z",
      "caption": "A normal day at work with a short update.",
      "hookText": "A normal day at work",
      "hashtags": [],
      "durationSeconds": 75,
      "format": "vlog",
      "audioName": "original",
      "followersAtPost": 10000,
      "views": 9250,
      "likes": 400,
      "comments": 20,
      "shares": 18,
      "saves": 10
    },
    {
      "postId": "p7",
      "platform": "tiktok",
      "creatorId": "creator-1",
      "publishedAt": "2026-07-07T14:00:00Z",
      "caption": "A normal day at work with a short update.",
      "hookText": "A normal day at work",
      "hashtags": [],
      "durationSeconds": 75,
      "format": "vlog",
      "audioName": "original",
      "followersAtPost": 10000,
      "views": 9500,
      "likes": 400,
      "comments": 20,
      "shares": 18,
      "saves": 10
    },
    {
      "postId": "p8",
      "platform": "tiktok",
      "creatorId": "creator-1",
      "publishedAt": "2026-07-08T14:00:00Z",
      "caption": "A normal day at work with a short update.",
      "hookText": "A normal day at work",
      "hashtags": [],
      "durationSeconds": 75,
      "format": "vlog",
      "audioName": "original",
      "followersAtPost": 10000,
      "views": 9750,
      "likes": 400,
      "comments": 20,
      "shares": 18,
      "saves": 10
    },
    {
      "postId": "p9",
      "platform": "tiktok",
      "creatorId": "creator-1",
      "publishedAt": "2026-07-09T14:00:00Z",
      "caption": "A normal day at work with a short update.",
      "hookText": "A normal day at work",
      "hashtags": [],
      "durationSeconds": 75,
      "format": "vlog",
      "audioName": "original",
      "followersAtPost": 10000,
      "views": 10000,
      "likes": 400,
      "comments": 20,
      "shares": 18,
      "saves": 10
    },
    {
      "postId": "p10",
      "platform": "tiktok",
      "creatorId": "creator-1",
      "publishedAt": "2026-07-10T14:00:00Z",
      "caption": "A normal day at work with a short update.",
      "hookText": "A normal day at work",
      "hashtags": [],
      "durationSeconds": 75,
      "format": "vlog",
      "audioName": "original",
      "followersAtPost": 10000,
      "views": 10250,
      "likes": 400,
      "comments": 20,
      "shares": 18,
      "saves": 10
    },
    {
      "postId": "p11",
      "platform": "tiktok",
      "creatorId": "creator-1",
      "publishedAt": "2026-07-11T14:00:00Z",
      "caption": "A normal day at work with a short update.",
      "hookText": "A normal day at work",
      "hashtags": [],
      "durationSeconds": 75,
      "format": "vlog",
      "audioName": "original",
      "followersAtPost": 10000,
      "views": 10500,
      "likes": 400,
      "comments": 20,
      "shares": 18,
      "saves": 10
    },
    {
      "postId": "p12",
      "platform": "tiktok",
      "creatorId": "creator-1",
      "publishedAt": "2026-07-12T14:00:00Z",
      "caption": "A normal day at work with a short update.",
      "hookText": "A normal day at work",
      "hashtags": [],
      "durationSeconds": 75,
      "format": "vlog",
      "audioName": "original",
      "followersAtPost": 10000,
      "views": 10750,
      "likes": 400,
      "comments": 20,
      "shares": 18,
      "saves": 10
    }
  ],
  "sourceUrls": [],
  "options": {
    "topPercent": 20,
    "minSupport": 3,
    "minimumLift": 1.15
  },
  "maxItems": 10000
}
```

# Actor output Schema

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

No description

## `reportUrl` (type: `string`):

No description

## `summaryUrl` (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("kayhermes/viral-content-pattern-miner").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("kayhermes/viral-content-pattern-miner").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 kayhermes/viral-content-pattern-miner --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,kayhermes/viral-content-pattern-miner"
        }
    }
}
```

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/yHxuSA1SJ7UsQHdjl/builds/BcCH2XDQFqaD5NOB7/openapi.json
