# YouTube Trending Tracker (`gochujang/youtube-trending-tracker`) Actor

Track YouTube trending videos by country and category. Returns title, channel, view count, like count, comment count, duration, tags, and thumbnail URL. Monitor viral content, track emerging creators, and analyze trending topics using the official YouTube Data API v3 free tier.

- **URL**: https://apify.com/gochujang/youtube-trending-tracker.md
- **Developed by:** [Hojun Lee](https://apify.com/gochujang) (community)
- **Categories:** Videos
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 item trackeds

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

## YouTube Trending Tracker

Track YouTube trending videos by country and category. Returns title, channel, view count, like count, comment count, duration, tags, and thumbnail URL. Monitor viral content, track emerging creators, and analyze trending topics using the official YouTube Data API v3 free tier.

### Features

- Fetch trending videos for **one or more countries** in a single run
- Filter by **YouTube category** (Music, Gaming, Entertainment, Science & Tech, etc.)
- Returns rich metadata: views, likes, comments, duration, tags, thumbnail, engagement rate
- **No API key required** — falls back to YouTube's public RSS feed automatically
- Engagement rate computed as `(likes + comments) / views`

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `apiKey` | string | — | YouTube Data API v3 key (optional). Without it, uses public RSS (limited data). |
| `countries` | array | `["US"]` | ISO 2-letter country codes, e.g. `["US", "GB", "KR", "JP"]` |
| `maxResults` | integer | 25 | Max trending videos per country (1–50) |
| `categoryId` | string | `"0"` | YouTube category ID. `0` = All. See category table below. |

#### YouTube Category IDs

| ID | Category |
|----|----------|
| 0 | All |
| 10 | Music |
| 20 | Gaming |
| 22 | People & Blogs |
| 23 | Comedy |
| 24 | Entertainment |
| 25 | News & Politics |
| 26 | Howto & Style |
| 28 | Science & Technology |

#### Getting a YouTube Data API v3 Key (Free)

1. Go to [Google Cloud Console](https://console.cloud.google.com/)
2. Create a project → Enable "YouTube Data API v3"
3. Credentials → Create API Key
4. Free tier: **10,000 units/day** (each trending request costs ~1 unit per video)

Without an API key, the actor falls back to YouTube's public RSS feed, which returns the global trending list without country filtering and with limited fields (no view/like/comment counts).

### Output

Each record represents one trending video:

```json
{
  "rank": 1,
  "country": "US",
  "video_id": "dQw4w9WgXcQ",
  "title": "Video Title",
  "channel": "Channel Name",
  "published_at": "2026-09-01T12:00:00Z",
  "view_count": 5000000,
  "like_count": 250000,
  "comment_count": 12000,
  "duration_seconds": 212,
  "duration_iso": "PT3M32S",
  "category_id": "10",
  "tags": ["music", "pop"],
  "thumbnail_url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg",
  "video_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "engagement_rate": 0.0524,
  "fetched_at": "2026-09-02T10:00:00Z",
  "data_source": "api"
}
```

Fields are `null` in RSS fallback mode (no API key) for `view_count`, `like_count`, `comment_count`, `duration_seconds`, `duration_iso`, `category_id`, and `tags`.

### Pricing

**$0.005 per video** (Pay-Per-Event). Fetching 25 videos for 4 countries = 100 videos = **$0.50**.

### Example Usage

#### Fetch US + Korea trending, top 25 each

```json
{
  "countries": ["US", "KR"],
  "maxResults": 25,
  "categoryId": "0"
}
```

#### Fetch gaming trending across multiple markets

```json
{
  "apiKey": "YOUR_API_KEY",
  "countries": ["US", "GB", "JP", "BR"],
  "maxResults": 50,
  "categoryId": "20"
}
```

#### Quick test without API key (RSS fallback)

```json
{
  "countries": ["US"],
  "maxResults": 25
}
```

### Use Cases

- **Viral content monitoring** — track what's trending before it peaks
- **Creator research** — discover emerging channels before they explode
- **Market intelligence** — correlate trending topics with brand mentions
- **Content strategy** — identify trending categories and themes by country
- **Ad placement research** — find high-engagement trending content

### Notes

- The YouTube Data API v3 free quota is **10,000 units/day**. Each country fetch uses ~1 unit per video retrieved.
- RSS fallback is global (does not support country-specific trending).
- `engagement_rate` = `(like_count + comment_count) / view_count` — null counts treated as 0.

***

### Related actors

- [YouTube Channel Stats](https://apify.com/gochujang/youtube-channel-stats) — Deep channel analytics for creators you discover in trending data
- [Reddit Subreddit Tracker](https://apify.com/gochujang/reddit-subreddit-tracker) — Reddit community discussion to cross-reference with YouTube trending topics
- [Tech News Aggregator](https://apify.com/gochujang/tech-news-aggregator) — News coverage that often follows viral YouTube tech videos

### Feedback

If this actor powers your content research, a review helps others find it: [Leave a review on Apify Store](https://apify.com/gochujang/youtube-trending-tracker#reviews)

***

**Keywords:** YouTube trending videos tracker, YouTube viral content monitor, trending YouTube by country, YouTube category trends, viral video data scraper, YouTube Data API v3, top YouTube videos, emerging YouTube creators, YouTube trending analytics, social media trend tracking, video view count scraper, YouTube tags extractor, content trend monitoring, no additional cost API

# Actor input Schema

## `apiKey` (type: `string`):

YouTube Data API v3 key (optional — without it, uses public RSS feed with limited data)

## `countries` (type: `array`):

ISO 2-letter country codes to fetch trending for (e.g. \['US', 'GB', 'KR'])

## `maxResults` (type: `integer`):

Maximum trending videos to return per country (1-50)

## `categoryId` (type: `string`):

YouTube category ID to filter (0=All, 10=Music, 20=Gaming, 24=Entertainment, 28=Science\&Tech)

## Actor input object example

```json
{
  "countries": [
    "US"
  ],
  "maxResults": 25,
  "categoryId": "0"
}
```

# Actor output Schema

## `results` (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("gochujang/youtube-trending-tracker").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("gochujang/youtube-trending-tracker").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 gochujang/youtube-trending-tracker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,gochujang/youtube-trending-tracker"
        }
    }
}
```

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/uyPUxSZULhatOt1Km/builds/CkbVi4tdSrAhCjnlf/openapi.json
