# YouTube Trending Videos by Categories Scraper (`eunit/youtube-trending-videos-by-categories`) Actor

Scrape real-time YouTube trending videos by country and category. Get detailed metrics like rank, title, views, likes, and channel name from 25+ countries. Monitor viral content, music, gaming, and more.

- **URL**: https://apify.com/eunit/youtube-trending-videos-by-categories.md
- **Developed by:** [Emmanuel Uchenna](https://apify.com/eunit) (community)
- **Categories:** Automation, Lead generation, Social media
- **Security:** Limited permissions
- **Stats:** 183 total users, 4 monthly users, 100.0% runs succeeded, 5 bookmarks
- **User rating**: 1.09 out of 5 stars

## Pricing

from $99.00 / 1,000 charging for each video scrapeds

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

## YouTube Trending Videos by Categories

### Overview

The **YouTube Trending Videos by Categories** Actor is a tool designed to extract real-time trending video data from YouTube. It allows you to scrape trending videos based on specific **countries** and **categories**, giving you deep insights into what is currently popular around the world.

Whether you are a content creator, market researcher, or social media manager, this Actor helps you stay ahead of the curve by providing granular data on trending content, including video titles, views, likes, and more.

### Features

- **Global Coverage**: Scrape trending videos from over **25 countries** (e.g., United States, United Kingdom, Brazil, India, Japan, etc.).
- **Category Filtering**: Narrow down trends by specific categories such as **Music**, **Gaming**, **News & Politics**, **Film & Animation**, and more.
- **Comprehensive Data**: Extracts detailed metrics including **Rank**, **Video Title**, **Channel Name**, **Views**, **Likes**, **Comments**, and **Thumbnail URLs**.
- **Real-Time Insights**: Get the data as it appears on the trends list right now.
- **Pay-Per-Event**: simple pricing model based on the number of records scraped.

### Use Cases

- **Content Strategy**: Identify what topics and formats are going viral in your niche to optimize your own content.
- **Market Research**: Analyze trending preferences in different regions to tailor your marketing campaigns.
- **Competitor Analysis**: Track successful channels and videos in your category.
- **Trend Monitoring**: Keep a pulse on breaking news and pop culture moments as they happen.

### How to Use

1. **Select Country**: Choose the country you want to scrape trends for from the dropdown list (e.g., "United Kingdom"). Leave it as "World" for global trends.
2. **Select Category**: Choose a specific category (e.g., "Music", "Gaming") or select "All" to get the general trending list.
3. **Run Actor**: Click the "Run" button to start scraping.
4. **Download Data**: Export your results in JSON, CSV, Excel, or other formats.

### Input Configuration

The Actor allows you to configure the following inputs:

| Field | Type | Description |
| :--- | :--- | :--- |
| `country` | String (Select) | The country to scrape trends for. Support includes US, UK, India, Brazil, France, etc. |
| `category` | String (Select) | The specific category of trends. Options include Music, Sports, Gaming, News, etc. |

### Output Data Structure

The scraper returns a structured dataset for each trending video. Here is a sample of the JSON output:

```json
[
  {
    "rank": "1",
    "video_title": "Marvel Television’s Wonder Man | Official Trailer",
    "video_url": "https://youtube.com/watch?v=wHuWmjXsReU",
    "video_id": "wHuWmjXsReU",
    "thumbnail_url": "https://i.ytimg.com/vi/wHuWmjXsReU/default.jpg",
    "author": "Marvel Entertainment",
    "published_time_text": "Yesterday",
    "views": "5.2M",
    "likes": "113K",
    "comments": "4.9K",
    "country": "united-kingdom",
    "category": "All"
  },
  {
  "rank": "2",
  "video_title": "AVENGERS DOOMSDAY LEAKED TRAILER 4",
  "video_url": "https://youtube.com/watch?v=d0Dl3kEOPJU",
  "video_id": "d0Dl3kEOPJU",
  "thumbnail_url": "https://i.ytimg.com/vi/d0Dl3kEOPJU/default.jpg",
  "author": "Everything Always",
  "published_time_text": "Yesterday",
  "views": "85K",
  "likes": "2.4K",
  "comments": "422",
  "country": "united-kingdom",
  "category": "All"
  },
  {
  "rank": "3",
  "video_title": "STEAL A BRAINROT GIVEAWAY LIVE | STEAL A BRAINROT FREE SECRETS + FREE BRAINROT GODS",
  "video_url": "https://youtube.com/watch?v=Crb5gudOABI",
  "video_id": "Crb5gudOABI",
  "thumbnail_url": "https://i.ytimg.com/vi/Crb5gudOABI/default.jpg",
  "author": "Joxy",
  "published_time_text": "16 hours ago",
  "views": "688K",
  "likes": "6.2K",
  "comments": "46",
  "country": "united-kingdom",
  "category": "All"
  },
  // ...
]
```

### Pricing

This Actor uses a **Pay-Per-Event** pricing model. You are charged a small fee for each video record successfully scraped. This ensures you only pay for the data you actually receive.

### Related Actors

Expand your data collection capabilities with these other powerful Apify Actors developed by the same author:

- **[Sitemap Generator](https://apify.com/eunit/youtube-trending-videos-by-categories)**: Boost SEO with this automatic Sitemap Generator. Crawl any site to create XML, HTML, & TXT sitemaps.
- **[Google Indexer](https://apify.com/eunit/google-indexing-api)**: Automatically submit URLs to the Google Indexing API to request crawling or removal.
- **[Twitter (X) Trends Scraper](https://apify.com/eunit/x-twitter-trends-scraper)**: Scrape real-time trends from Twitter/X for any country or city.
- **[LinkedIn Job Postings Scraper](https://apify.com/eunit/linkedin-job-postings-scraper)**: Extract tailored job titles, company names, and locations from LinkedIn.

### Support & Feedback

We are always working on improving the performance of our Actors. So if you’ve got any technical feedback for the [YouTube Trending Videos by Categories](https://apify.com/eunit/youtube-trending-videos-by-categories) Actor or simply found a bug, please create an issue on the [Actor’s Issues tab](https://console.apify.com/actors/SKLO5UePDhacu6FX3/issues) in [Apify Console](https://console.apify.com/actors/SKLO5UePDhacu6FX3).

# Actor input Schema

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

Select the country to scrape trends for.

## `category` (type: `string`):

Select the category of trends to scrape.

## Actor input object example

```json
{
  "country": "",
  "category": "all"
}
```

# 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("eunit/youtube-trending-videos-by-categories").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("eunit/youtube-trending-videos-by-categories").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 eunit/youtube-trending-videos-by-categories --silent --output-dataset

```

## MCP server setup

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

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/SKLO5UePDhacu6FX3/builds/jeKTnUnmX60oeabnp/openapi.json
