# TikTok Sound Scraper - Music Metadata & Videos (`khadinakbar/tiktok-sound-scraper`) Actor

Scrape TikTok sound metadata, audio preview links, artist details, usage counts, and videos using a sound. Provider-backed with ScrapeCreators primary and SociaVault fallback. MCP/API-ready.

- **URL**: https://apify.com/khadinakbar/tiktok-sound-scraper.md
- **Developed by:** [Khadin Akbar](https://apify.com/khadinakbar) (community)
- **Categories:** Social media, Lead generation, Automation
- **Stats:** 19 total users, 11 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event + usage

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## TikTok Sound Scraper

Scrape TikTok sound metadata and videos that use a sound. The actor accepts TikTok `/music/` URLs, raw clip IDs, or music search queries and exports normalized rows for analytics, creator research, trend monitoring, and AI-agent workflows.

This actor is provider-backed:

- Primary: ScrapeCreators `/v1/tiktok/song` and `/v1/tiktok/song/videos`
- Fallback: SociaVault `/v1/scrape/tiktok/music/details` and `/v1/scrape/tiktok/music/videos`
- Search: SociaVault `/v1/scrape/tiktok/search/music`

It does not ask users for TikTok cookies and does not scrape private or logged-in TikTok surfaces.

### What It Extracts

Sound rows include:

| Field | Description |
| --- | --- |
| `clipId` | TikTok sound clip ID |
| `soundUrl` | TikTok music page URL |
| `title`, `author`, `album` | Sound and artist metadata |
| `durationSeconds`, `fullSongDurationMs` | Clip and matched full-song duration |
| `userCount` | Number of TikTok videos using the sound when returned |
| `coverUrl`, `audioUrl`, `shareUrl` | Media links returned by the provider; some URLs can expire |
| `isOriginal`, `isCommerceMusic`, `hasCommerceRight`, `canReuse` | Rights and reuse flags when exposed |
| `matchedSongTitle`, `matchedSongAuthor` | Matched catalog song fields |
| `themeTags`, `artists` | Genre/mood tags and artist profile objects |

Video rows include:

| Field | Description |
| --- | --- |
| `videoId`, `videoUrl` | TikTok video identifiers |
| `caption`, `hashtags`, `createdAt` | Video content metadata |
| `authorUsername`, `authorNickname`, `authorVerified` | Creator metadata |
| `playCount`, `likeCount`, `commentCount`, `shareCount`, `collectCount` | Engagement metrics |
| `coverUrl`, `durationMs`, `region` | Video media metadata |

### Inputs

- `soundUrls` - TikTok music URLs such as `https://www.tiktok.com/music/luther-7439295283975702544`.
- `clipIds` - raw TikTok sound clip IDs.
- `searchQueries` - optional music search queries. Search requires SociaVault.
- `outputMode` - `sounds_and_videos`, `sounds`, or `videos`.
- `providerOrder` - ScrapeCreators first, SociaVault first, or a single-provider mode.
- `maxSounds` - total unique sounds processed.
- `maxVideosPerSound` - video rows to save per sound.
- `maxPagesPerSound` - safety cap for provider pagination.
- `region`, `filterBy`, `sortType` - SociaVault search controls.
- `includeRawData` - attach raw provider payloads to rows.

### Example Input

```json
{
  "soundUrls": [
    "https://www.tiktok.com/music/luther-7439295283975702544"
  ],
  "outputMode": "sounds_and_videos",
  "maxSounds": 1,
  "maxVideosPerSound": 25,
  "maxPagesPerSound": 5,
  "providerOrder": "scrapecreators-first",
  "includeRawData": false
}
```

### Search Example

```json
{
  "searchQueries": ["luther kendrick", "viral skincare sound"],
  "region": "US",
  "sortType": "1",
  "maxSearchResultsPerQuery": 5,
  "maxVideosPerSound": 20
}
```

### Example Output

```json
{
  "recordType": "sound",
  "provider": "scrapecreators",
  "clipId": "7439295283975702544",
  "soundUrl": "https://www.tiktok.com/music/luther-7439295283975702544",
  "title": "luther",
  "author": "Kendrick Lamar & SZA",
  "album": "GNX",
  "durationSeconds": 59,
  "userCount": 482194,
  "coverUrl": "https://p16-sg.tiktokcdn.com/aweme/720x720/example.jpeg",
  "audioUrl": "https://sf16-ies-music-sg.tiktokcdn.com/obj/example",
  "scrapedAt": "2026-06-10T00:00:00.000Z"
}
```

```json
{
  "recordType": "video",
  "provider": "scrapecreators",
  "clipId": "7439295283975702544",
  "soundTitle": "luther",
  "videoId": "7452069943757114646",
  "videoUrl": "https://www.tiktok.com/@creator/video/7452069943757114646",
  "authorUsername": "creator",
  "caption": "Using this sound",
  "playCount": 2932976,
  "likeCount": 197747,
  "commentCount": 347,
  "shareCount": 26467,
  "scrapedAt": "2026-06-10T00:00:00.000Z"
}
```

### Run Summary

Every run writes `OUTPUT` and `RUN_SUMMARY` records to the default key-value store:

```json
{
  "recordsSaved": 26,
  "soundsSaved": 1,
  "videosSaved": 25,
  "soundsProcessed": 1,
  "providersUsed": ["scrapecreators"],
  "providerAttempts": {
    "scrapecreators.soundDetails": 1,
    "scrapecreators.soundVideos": 3
  },
  "estimatedPpeCostUsd": 0.0405,
  "stopReason": "finished"
}
```

Common `stopReason` values:

- `finished` - selected sounds were processed.
- `invalid-input` - no valid TikTok sound URL, clip ID, or query was provided.
- `missing-api-key` - actor owner has not configured provider API keys.
- `no-sounds-discovered` - search did not return usable sounds.
- `provider-error` - all configured providers failed before any rows were saved.
- `event-limit-reached` - Apify PPE charge limit stopped the run.

### Pricing

This actor is designed for pay-per-event monetization:

- `apify-actor-start`: small start event.
- `sound-scraped`: one saved TikTok sound metadata row.
- `video-scraped`: one saved TikTok video row using the sound.

The actor logs a maximum possible PPE estimate before scraping based on `maxSounds` and `maxVideosPerSound`.

### Limitations

TikTok and provider availability can change. Audio and cover URLs are provider-returned CDN URLs and may expire. Search currently uses SociaVault because the verified live ScrapeCreators docs expose sound details and videos but not a dedicated music-search endpoint. Output is public-data best effort and may differ by region, sound availability, provider coverage, or TikTok takedowns.

### API Example

```bash
curl -X POST "https://api.apify.com/v2/acts/khadinakbar~tiktok-sound-scraper/runs?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"soundUrls":["https://www.tiktok.com/music/luther-7439295283975702544"],"maxVideosPerSound":25}'
```

### Legal

This actor is intended for public web data available through the configured providers. You are responsible for using the output in compliance with applicable laws, platform terms, privacy requirements, and your own data governance policies.

# Actor input Schema

## `soundUrls` (type: `array`):

TikTok sound/music URLs. Example: https://www.tiktok.com/music/luther-7439295283975702544

## `startUrls` (type: `array`):

Alternative Apify-style URL input. Add TikTok /music/ URLs here if you prefer request-list input.

## `clipIds` (type: `array`):

Raw TikTok sound clip IDs. The clip ID is the long numeric ID at the end of a TikTok /music/ URL.

## `searchQueries` (type: `array`):

Optional TikTok music search queries. Search uses SociaVault's TikTok music search endpoint and then scrapes each discovered sound.

## `outputMode` (type: `string`):

Choose whether to save sound metadata, videos using the sound, or both.

## `providerOrder` (type: `string`):

Choose which provider is tried first for sound details and videos. ScrapeCreators is the recommended primary. SociaVault is required for search queries.

## `maxSounds` (type: `integer`):

Maximum number of unique sounds to process across direct inputs and search results.

## `maxSearchResultsPerQuery` (type: `integer`):

Maximum number of TikTok sounds discovered from each search query.

## `maxVideosPerSound` (type: `integer`):

Maximum videos to save for each sound. Set 0 to save sound metadata only.

## `maxPagesPerSound` (type: `integer`):

Safety cap for provider pagination while collecting videos using a sound.

## `region` (type: `string`):

Alpha-2 country code used for SociaVault music search. Direct clip ID scraping does not require a region.

## `filterBy` (type: `string`):

SociaVault music search filter: 0 all, 1 title, 2 creators.

## `sortType` (type: `string`):

SociaVault music search sort: 0 relevance, 1 most used, 2 most recent, 3 shortest, 4 longest.

## `includeRawData` (type: `boolean`):

Include raw provider payloads on each row for debugging and custom downstream parsing.

## Actor input object example

```json
{
  "soundUrls": [
    "https://www.tiktok.com/music/luther-7439295283975702544"
  ],
  "startUrls": [
    {
      "url": "https://www.tiktok.com/music/luther-7439295283975702544"
    }
  ],
  "clipIds": [
    "7439295283975702544"
  ],
  "searchQueries": [
    "luther kendrick"
  ],
  "outputMode": "sounds_and_videos",
  "providerOrder": "scrapecreators-first",
  "maxSounds": 5,
  "maxSearchResultsPerQuery": 5,
  "maxVideosPerSound": 25,
  "maxPagesPerSound": 5,
  "region": "US",
  "filterBy": "0",
  "sortType": "0",
  "includeRawData": false
}
```

# Actor output Schema

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

Sound metadata and videos using the sound.

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

Run diagnostics and provider telemetry.

# 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 = {
    "soundUrls": [
        "https://www.tiktok.com/music/luther-7439295283975702544"
    ],
    "startUrls": [
        {
            "url": "https://www.tiktok.com/music/luther-7439295283975702544"
        }
    ],
    "clipIds": [
        "7439295283975702544"
    ],
    "searchQueries": [
        "luther kendrick"
    ],
    "maxSounds": 5,
    "maxSearchResultsPerQuery": 5,
    "maxVideosPerSound": 25,
    "maxPagesPerSound": 5,
    "region": "US"
};

// Run the Actor and wait for it to finish
const run = await client.actor("khadinakbar/tiktok-sound-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 = {
    "soundUrls": ["https://www.tiktok.com/music/luther-7439295283975702544"],
    "startUrls": [{ "url": "https://www.tiktok.com/music/luther-7439295283975702544" }],
    "clipIds": ["7439295283975702544"],
    "searchQueries": ["luther kendrick"],
    "maxSounds": 5,
    "maxSearchResultsPerQuery": 5,
    "maxVideosPerSound": 25,
    "maxPagesPerSound": 5,
    "region": "US",
}

# Run the Actor and wait for it to finish
run = client.actor("khadinakbar/tiktok-sound-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "soundUrls": [
    "https://www.tiktok.com/music/luther-7439295283975702544"
  ],
  "startUrls": [
    {
      "url": "https://www.tiktok.com/music/luther-7439295283975702544"
    }
  ],
  "clipIds": [
    "7439295283975702544"
  ],
  "searchQueries": [
    "luther kendrick"
  ],
  "maxSounds": 5,
  "maxSearchResultsPerQuery": 5,
  "maxVideosPerSound": 25,
  "maxPagesPerSound": 5,
  "region": "US"
}' |
apify call khadinakbar/tiktok-sound-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=khadinakbar/tiktok-sound-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/FCbgBGSx17y0nF3Zw/builds/nZMq161ZG1nPevXyi/openapi.json
