# Tiktok Trending Songs Analytics (`codebyte/tiktok-trending-songs-analytics`) Actor

Unlock TikTok's trending songs and music with comprehensive analytics and audience insights. Gather data on music trends by country. Find trending commercial music to supercharge your TikTok content strategy.

- **URL**: https://apify.com/codebyte/tiktok-trending-songs-analytics.md
- **Developed by:** [Codebyte](https://apify.com/codebyte) (community)
- **Categories:** Social media, E-commerce
- **Features:** Full permissions
- **Stats:** 172 total users, 8 monthly users, 99.9% runs succeeded, 14 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 Trending Songs Analytics

Discover new trends on TikTok through songs.
Get comprehensive analytics and insights for music on TikTok.

### Key Features

- Get the top 100 trending songs for each country in the last 7/30/120 days
- Get detailed analytics for trending music
- Analyze audience demographics and age distribution
- Discover related interests and regional popularity
- Find trending songs and related videos

Perfect for social media managers, content creators, and marketing professionals who want to leverage data-driven insights for their TikTok strategy.

## Input

#### Rank Type

Popular - A ranked list of the most popular songs within the region and timeframe you selected.
Will return up to 100 results depending on region and filters used.

Surging - A ranked list of songs that are growing at a significant rate, within the region and timeframe you selected.
Will usually return 15-30 results depending on region and filters used.

To start, select the type of result you want to retrieve.

#### Top 100 ranking only

Retrieve the top 100 trending songs for a given country and time frame.

```json
{
    "result_type": "top100",
    "country": "US",
    "period": "7",
    "top100_rank_type": "popular",
    "top100_commercial_music": false,
    "top100_new_on_board": false
}
```

#### Example output

```json
[
    {
        "author": "SlvixalBoy",
        "clip_id": "7373935903716935681",
        "cml_mid": "7375041366630957057",
        "country_code": "US",
        "cover": "https://p16-sg.tiktokcdn.com/aweme/720x720/tos-alisg-v-2774/ogmFaZiWZER7EBAEaApYr4UAAAllERbLiBBgv.jpeg",
        "duration": 106,
        "if_cml": true,
        "is_search": false,
        "link": "https://www.tiktok.com/music/x-7373935903716935681",
        "music_url": "https://sf19-ies-music-sg.tiktokcdn.com/obj/tos-alisg-ve-2774/oAXtWVgKWFa2CBQT5mqrZSgDuEQpfB0DYqe68i",
        "on_list_times": null,
        "promoted": false,
        "rank": 21,
        "rank_diff": null,
        "rank_diff_type": 4,
        "related_items": [
            {
                "item_id": 7457282630245993000,
                "cover_uri": "https://p16-sign-va.tiktokcdn.com/tos-maliva-p-0068c799-us/oQW9YPqiqzILBIJEHAizAlhBw3pWTB5xfsvCJx~tplv-noop.image?x-expires=1736808674&x-signature=9eaeo7zSrOqUvX4QTq8F2palgzo%3D"
            },
            ...
        ],
        "song_id": "7373935879872759825",
        "title": "Tropical Sunshine",
        "trend": [
            {
                "time": 1736121600,
                "value": 1
            },
            ...
        ],
        "url_title": "Tropical-Sunshine",
        "period": "7",
        "rank_change_readable": "New"
    },
    ...
]
```

#### Top 100 ranking including song analytics

Retrieve the top 100 trending songs for a given country and time frame, including song analytics.

```json
{
    "result_type": "top100_with_analytics",
    "country": "US",
    "period": "7",
    "top100_rank_type": "popular",
    "top100_commercial_music": false,
    "top100_new_on_board": false
}
```

#### Example output excerpt

```json
[
    ...
    "analytics": {
            "audience_ages": [
                {
                    "age_level": 3,
                    "score": 100
                }
            ],
            "audience_countries": [
                {
                    "country_info": {
                        "id": "2635167",
                        "label": "GB",
                        "value": "United Kingdom"
                    },
                    "score": 771
                },
                ...
            ],
            "audience_interests": [
                {
                    "interest_info": {
                        "id": "10057",
                        "label": "diversify_10057",
                        "value": "Non-Video Games"
                    },
                    "score": 304
                },
                ...
            ],
            "author": "SlvixalBoy",
            "clip_id": "7373935903716935681",
            "cml_mid": "7375041366630957057",
            "country_code": "US",
            "cover": "https://p16-sg.tiktokcdn.com/aweme/720x720/tos-alisg-v-2774/ogmFaZiWZER7EBAEaApYr4UAAAllERbLiBBgv.jpeg",
            "duration": 106,
            "if_cml": true,
            "is_search": false,
            "link": "https://www.tiktok.com/music/x-7373935903716935681",
            "longevity": {
                "popular_days": 0,
                "current_popularity": 0
            },
            "music_url": "https://sf19-ies-music-sg.tiktokcdn.com/obj/tos-alisg-ve-2774/oAXtWVgKWFa2CBQT5mqrZSgDuEQpfB0DYqe68i",
            "on_list_times": null,
            "promoted": false,
            "rank": null,
            "rank_diff": null,
            "related_items": [
                {
                    "item_id": 7457282630245993000,
                    "cover_uri": "https://p16-sign-va.tiktokcdn.com/tos-maliva-p-0068c799-us/oQW9YPqiqzILBIJEHAizAlhBw3pWTB5xfsvCJx~tplv-noop.image?x-expires=1736808675&x-signature=Ko9yK2IkHm6cGQgP3Glby2e1b4M%3D"
                },
                ...
            ],
            "song_id": "7373935879872759825",
            "title": "Tropical Sunshine",
            "trend": [
                {
                    "time": 1736121600,
                    "value": 1
                },
                ...
            ],
            "url_title": "Tropical-Sunshine",
            "audience_ages_readable": [
                {
                    "age_range": "18-24",
                    "score": 100
                }
            ]
        }
]
```

#### Song analytics only

Retrieve detailed analytics for a custom list of music/clip ids.
For this example url https://www.tiktok.com/music/x-7373935903716935681 use 7373935903716935681 as id

```json
{
    "result_type": "analytics",
    "song_list": ["7373935903716935681"],
    "country": "US",
    "period": "30"
}
```

If a song you provide is not popular enough (in this country and period), TikTok will not return any data for this song.

## Insights that song analytics can provide

### Interest over time

Each data point compares the relative volume against the peak volume of the trend. A value of 100 is the peak popularity for the trend.

### Audience insights

Information about viewers that watch videos associated with this trend.

#### Age range

The approximate percentage of viewers associated with different age ranges. Only available for age ranges above 18 years old.

#### Related interests

The top interests associated with viewers of this trend. The value represents an index score. Example: If the score is 200, the interest category is 2x as popular with viewers of this trend compared to its average popularity on TikTok worldwide.

#### Regional popularity

The top locations in the world where this term is most popular. The value represents an index score. Example: If the score is 200, the trend is 2x as popular in this market compared to its average popularity on TikTok worldwide.

#### Related videos

Trending videos that use this song in the selected region and time frame.

# Actor input Schema

## `result_type` (type: `string`):

Select the type of result you want the actor to retrieve. Top 100 ranking only, top 100 ranking including song analytics or song analytics for a custom list of music/clip ids.

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

Select the country for which you want to retrieve the top ranking songs / song analytics.

## `period` (type: `string`):

Select the period for which you want to retrieve the top ranking songs / song analytics.

## `top100_rank_type` (type: `string`):

Select the ranking type. Popular will return the most popular songs up to 100 results. Surging will usually return 15-30 songs that are growing in popularity at a significant rate.

## `top100_new_on_board` (type: `boolean`):

For top 100 ranking, only return entries that are new to the top 100 for this period.

## `top100_commercial_music` (type: `boolean`):

For top 100 ranking, only return entries that are commercial music.

## `song_list` (type: `array`):

List of music/clip ids for which you want to retrieve analytics. For the example url https://www.tiktok.com/music/x-7373935903716935681 use 7373935903716935681 as id

## Actor input object example

```json
{
  "result_type": "top100",
  "country": "US",
  "period": "7",
  "top100_rank_type": "popular",
  "top100_new_on_board": false,
  "top100_commercial_music": false
}
```

# 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 = {
    "result_type": "top100"
};

// Run the Actor and wait for it to finish
const run = await client.actor("codebyte/tiktok-trending-songs-analytics").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 = { "result_type": "top100" }

# Run the Actor and wait for it to finish
run = client.actor("codebyte/tiktok-trending-songs-analytics").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 '{
  "result_type": "top100"
}' |
apify call codebyte/tiktok-trending-songs-analytics --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,codebyte/tiktok-trending-songs-analytics"
        }
    }
}
```

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/EMeGJijgB6VRfxqOa/builds/x9S8LcjoSdbx1N2ND/openapi.json
