# Viral Audio Scraper (`andrew_babo/viral-audio-scraper`) Actor

- **URL**: https://apify.com/andrew\_babo/viral-audio-scraper.md
- **Developed by:** [Andrew Babo](https://apify.com/andrew_babo) (community)
- **Stats:** 7 total users, 6 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

## Viral Audio Scraper — trending sounds on TikTok, YouTube Shorts and Instagram Reels

One actor for the question every short-form creator asks: **which songs are going viral right now, and can I download them?**

It scans TikTok, YouTube Shorts and Instagram Reels in a single run, ranks the sounds it sees, flags the ones that are viral on more than one platform, and can save the audio file for you.

No login. No cookies. No account of yours is used anywhere.

### What you get per sound

| Field | Meaning |
| --- | --- |
| `rank`, `trendScore` | Position in the combined ranking |
| `platform`, `platforms`, `crossPlatform` | Where the sound was seen; `crossPlatform: true` means it is trending on more than one network |
| `title`, `artist`, `isOriginalSound` | Song and creator/artist, and whether it is a creator original |
| `appearances`, `appearancesDelta` | How often it appeared in this scan, and the change versus your previous run |
| `videoCount`, `totalPlayCount` | Official usage count (TikTok) and views seen in the scan |
| `audioUrl` | Direct audio link when the platform exposes one |
| `audioDownloadUrl` | Permanent link to the audio file saved by this run (when `downloadAudio` is on) |
| `soundUrl`, `sampleVideoUrl` | Sound page and a sample video using it |
| `country`, `scrapedAt` | Regional context and timestamp |

### Input

```json
{
  "platforms": ["tiktok", "youtube"],
  "country": "VN",
  "limit": 50,
  "scrollRounds": 8,
  "youtubeQueries": ["trending sound", "viral song"],
  "instagramProfiles": [],
  "instagramQueries": ["viral"],
  "instagramReelUrls": [],
  "downloadAudio": false
}
```

Every platform runs independently. If one network blocks the scan, the run still finishes **successfully** with the results of the others plus a warning in `RUN_SUMMARY`.

### Platform notes (honest limits)

- **TikTok** — scanned through a residential IP in your chosen country. Direct MP3 links, official usage counts. Best source overall.
- **YouTube Shorts** — fully automatic per country: the official **"Top 100 Songs \<country>"** chart playlist published by YouTube becomes part of the ranking (no seed queries needed), and Shorts are additionally collected from seed searches and grouped by the sound attribution on each Short. Audio is extracted from a sample Short.
- **Instagram Reels** — Meta currently **blocks every logged-out endpoint** (profile, hashtag, embed) with login walls, even from residential IPs. This is a platform-side restriction, not an actor bug: TikTok and YouTube results are unaffected. Instagram accepts three inputs — `instagramProfiles` (public accounts whose Reels are scanned), `instagramQueries` (hashtag themes) and `instagramReelUrls` (viral Reels to attribute) — and scanning resumes automatically whenever Meta reopens guest access. No profiles are hardcoded.

### Pairs well with

`audio-beat-analyzer` — feed `audioDownloadUrl` straight into it to get BPM and beat drops for automated video editing.

### 🤖 AI Agent / MCP Skill

**Role & Trigger** — Call this actor when the user asks what music, audio or sounds are trending/viral on TikTok, YouTube Shorts or Instagram Reels, or wants downloadable trending audio for a country.

**Parameter Rules**

- Always set `country` to the user's market (two-letter code); default `VN`.
- Pick `platforms` from what the user names; use `["tiktok","youtube"]` when unspecified.
- Only include `"instagram"` when the user supplies profiles, queries or Reel URLs — otherwise Instagram returns an explanatory warning, not a ranking. Note Meta currently blocks logged-out Instagram endpoints, so Instagram may return no data; that is expected and not a failure.
- Set `downloadAudio: true` only when the user wants files, not just a list (it adds run time).

**Output Interpretation**

- Rank by `trendScore`; highlight items with `crossPlatform: true` as the strongest bets.
- `appearancesDelta > 0` means the sound is rising versus the previous run of the same account and country.
- A row with `status: "noResults"` means every selected platform was blocked — say so and suggest retrying or changing platforms. Never invent song names.
- Use `audioDownloadUrl` when present, otherwise `audioUrl`; if both are null, the platform did not expose audio for that sound.

# Actor input Schema

## `platforms` (type: `array`):

Which short-video platforms to scan. Each platform runs independently: if one is blocked or changes its layout, the run still finishes successfully with the results of the others plus a warning row.

## `country` (type: `string`):

Two-letter country code used to personalize what is trending, e.g. "VN", "US", "JP". TikTok is scanned through a residential IP in this country; YouTube results use the same regional context.

## `limit` (type: `integer`):

Maximum number of ranked sounds in the output (across all selected platforms).

## `scrollRounds` (type: `integer`):

How many batches of TikTok trending videos to scan. One round is roughly 15-25 videos.

## `youtubeQueries` (type: `array`):

Search phrases used to collect Shorts for the sound ranking. Leave empty to use sensible defaults (trending sound / viral song Shorts).

## `instagramQueries` (type: `array`):

Hashtag keywords to scan for trending Reels audio (e.g. "viral", "remix", "trending"). Optional; combine with profiles for better coverage.

## `instagramReelUrls` (type: `array`):

Direct links to public Reels whose audio you want identified (paste URLs or shortcodes). Works without login via the public embed page.

## `instagramProfiles` (type: `array`):

Public Instagram usernames whose recent Reels are scanned for song attribution. Instagram has no public trending chart for logged-out visitors, so the ranking is built from the accounts you list here (trend-setting creators in your niche work best).

## `downloadAudio` (type: `boolean`):

When enabled, the actor downloads each sound's audio into the run's key-value store and adds a permanent audioDownloadUrl. Off by default: items still include a direct audioUrl when the platform exposes one.

## `originalSoundsOnly` (type: `boolean`):

Restrict output to creator-made original sounds (no licensed commercial songs). Useful when you need copyright-safer audio.

## `failOnZeroResults` (type: `boolean`):

Off by default: when every platform is blocked, the run writes an explanatory status row and finishes successfully (keeps schedules green). Turn on to fail hard instead.

## Actor input object example

```json
{
  "platforms": [
    "tiktok",
    "youtube"
  ],
  "country": "VN",
  "limit": 50,
  "scrollRounds": 8,
  "youtubeQueries": [
    "trending sound",
    "viral song"
  ],
  "instagramQueries": [
    "viral"
  ],
  "instagramReelUrls": [],
  "instagramProfiles": [
    "instagram"
  ],
  "downloadAudio": false,
  "originalSoundsOnly": false,
  "failOnZeroResults": false
}
```

# Actor output Schema

## `RUN_SUMMARY` (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 = {
    "platforms": [
        "tiktok",
        "youtube"
    ],
    "country": "VN",
    "youtubeQueries": [
        "trending sound",
        "viral song"
    ],
    "instagramQueries": [
        "viral"
    ],
    "instagramReelUrls": [],
    "instagramProfiles": [
        "instagram"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("andrew_babo/viral-audio-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 = {
    "platforms": [
        "tiktok",
        "youtube",
    ],
    "country": "VN",
    "youtubeQueries": [
        "trending sound",
        "viral song",
    ],
    "instagramQueries": ["viral"],
    "instagramReelUrls": [],
    "instagramProfiles": ["instagram"],
}

# Run the Actor and wait for it to finish
run = client.actor("andrew_babo/viral-audio-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 '{
  "platforms": [
    "tiktok",
    "youtube"
  ],
  "country": "VN",
  "youtubeQueries": [
    "trending sound",
    "viral song"
  ],
  "instagramQueries": [
    "viral"
  ],
  "instagramReelUrls": [],
  "instagramProfiles": [
    "instagram"
  ]
}' |
apify call andrew_babo/viral-audio-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,andrew_babo/viral-audio-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/lfZ36EUmwVdxVUidq/builds/6TmUJ6tzKowP7BsXf/openapi.json
