# TikTok Public Music Page Scraper (`w3crawler/tiktok-music-scraper`) Actor

Extract public TikTok music-page metadata, page text, images, links, and visible post URLs from public music URLs or numeric sound IDs.

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

## Pricing

from $2.99 / 1,000 music

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/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 Public Music Page Scraper

Extract public TikTok music/sound-page metadata from public music URLs or numeric sound IDs. The Actor retrieves a public reader representation first and then tries the direct page, parses title, description, creator, duration, cover images, links, visible video URLs, and bounded page text, and writes one record per target.

This Actor does not crawl every video using a sound and does not use cookies, private profiles, or authenticated endpoints.

### Example input

```json
{
  "musicUrls": [
    "https://www.tiktok.com/music/original-sound-7595604258835401494"
  ],
  "maxItems": 2
}
```

Numeric IDs can be supplied instead:

```json
{
  "musicIds": ["7595604258835401494"]
}
```

If no URL or ID is supplied, the Actor uses two representative public music-page URLs. `maxItems` limits the number of unique pages requested.

### Example output

```json
{
  "recordType": "tiktok-music",
  "status": "success",
  "dataAvailable": true,
  "source": "tiktok.com",
  "provenance": "public_tiktok_music_page",
  "sourceTransport": "jina-reader",
  "extractionMethod": "public_music_page_text_and_links",
  "musicUrl": "https://www.tiktok.com/music/original-sound-7595604258835401494",
  "musicId": "7595604258835401494",
  "musicTitle": "Original sound",
  "artist": "creator",
  "durationSeconds": 12,
  "coverImageUrl": "https://cdn.example/cover.jpg",
  "postUrls": ["https://www.tiktok.com/@creator/video/1234567890"],
  "postCount": 1,
  "postsAvailable": true,
  "scrapedAt": "2026-08-18T00:00:00.000Z"
}
```

When neither public retrieval path returns usable content, the dataset receives a `tiktok-music-access-diagnostic` or `tiktok-music-request-diagnostic` record, and the `OUTPUT` summary reports failure.

### Input

- `musicUrls` (array, optional): Public HTTPS TikTok music-page URLs containing `/music/`.
- `musicIds` (array, optional): Numeric sound IDs, 10–30 digits; converted to public `/music/<id>` URLs.
- `maxItems` (integer, 1–10): Maximum unique public music pages to request. Default: `10`.

The historical controls for maximum sound posts and separate music/post row modes were removed because this implementation only parses each public music page and does not crawl its post list.

### Output and storage

Music-page records and access diagnostics are written to the default dataset. The Output tab links to the dataset and to `OUTPUT` in the default key-value store.

`OUTPUT` contains requested and processed target counts, usable record count, failed URL list, status, and timestamp. `postUrls` in a music record are links visible in the page representation; they are not individually fetched.

### Limitations and cost

The Actor makes at most one public reader request and one direct page request per target. TikTok page markup, signed image URLs, and visible post links can change. Missing source values are omitted, and the returned post count is only the count of visible links found in the bounded representation.

Apify compute and public HTTP traffic are the main costs. Start with one target and a small `maxItems` value, and avoid high-frequency retries.

### FAQ and disclaimer

#### Does it return every video using the sound?

No. It reports only public video URLs visible in the retrieved music-page representation and does not crawl those videos.

#### Why did the Actor use `jina-reader`?

The public reader representation is tried first because TikTok may return a challenge or script-heavy page to direct HTTP clients. The transport is recorded for auditability.

#### Does it access private music or user data?

No. It requests public pages only and does not bypass authentication or access controls.

Use public data for a legitimate purpose, follow TikTok and `r.jina.ai` terms and robots guidance, and review privacy and data-protection obligations. For support, use the Actor Issues tab.

# Actor input Schema

## `musicUrls` (type: `array`):

Public HTTPS TikTok music-page URLs containing /music/.

## `musicIds` (type: `array`):

Numeric TikTok music/sound IDs, 10 to 30 digits. IDs are converted into public /music/<id> URLs.

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

Maximum unique public music-page targets to request.

## Actor input object example

```json
{
  "musicUrls": [
    "https://www.tiktok.com/music/original-sound-7595604258835401494"
  ],
  "musicIds": [
    "7595604258835401494"
  ],
  "maxItems": 2
}
```

# Actor output Schema

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

No description

## `runSummary` (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 = {
    "musicUrls": [
        "https://www.tiktok.com/music/original-sound-7595604258835401494"
    ],
    "musicIds": [
        "7595604258835401494"
    ],
    "maxItems": 2
};

// Run the Actor and wait for it to finish
const run = await client.actor("w3crawler/tiktok-music-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 = {
    "musicUrls": ["https://www.tiktok.com/music/original-sound-7595604258835401494"],
    "musicIds": ["7595604258835401494"],
    "maxItems": 2,
}

# Run the Actor and wait for it to finish
run = client.actor("w3crawler/tiktok-music-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 '{
  "musicUrls": [
    "https://www.tiktok.com/music/original-sound-7595604258835401494"
  ],
  "musicIds": [
    "7595604258835401494"
  ],
  "maxItems": 2
}' |
apify call w3crawler/tiktok-music-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,w3crawler/tiktok-music-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/DIv2OVry3eBshB4Xv/builds/AuUXsbA5x7yXQc9c5/openapi.json
