# YouTube Trending Scraper (`dami_studio/youtube-trending-scraper`) Actor

YouTube trending scraper for the most-viewed videos on any topic. YouTube retired the Trending feed, so this searches each topic and sorts by views: the ranking is all-time, not this week. Each row has the title, views, age, duration, channel, thumbnail and URL. $0.40 per 1,000 videos.

- **URL**: https://apify.com/dami_studio/youtube-trending-scraper.md
- **Developed by:** [Dami's Studio](https://apify.com/dami_studio) (community)
- **Categories:** Social media
- **Features:** Limited permissions
- **Stats:** 5 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.38 / 1,000 videos

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 scraper for the most-viewed videos on any topic you name**: give it a list of topics and get
back the videos with the highest view counts for each one, with title, channel, view count, age,
duration, thumbnail and the watch URL. No account, no API key, no quota.

Read this before you buy, because the name promises something YouTube no longer offers. **YouTube
retired the standalone Trending feed, so there is nothing left to read.** What this does instead is
search each topic and sort by views, which means the ranking is **all-time, not this week**. Ask it
for "music" and the top of the list is a video with a hundred million views from three months ago,
not the clip everyone is sharing today. If what you need is what is rising right now, this is the
wrong purchase, however cheap it is.

| | |
|---|---|
| **Input** | Topics or keywords, one per line |
| **Output** | One row per video: title, channel name and id, views, age and duration as YouTube prints them, thumbnail, watch URL |
| **Ceiling** | 2,000 videos per run |
| **Account needed** | None |
| **Price** | $0.40 per 1,000 videos on the Free plan, a little less on paid plans. The free plan's $5 a month covers about 12,500 |

### 🔍 What YouTube Trending Scraper does

One search per topic, sorted by view count, paged until it has what you asked for or the topic runs
out. Give it five topics and a limit of 100 and it works down the list, stopping the moment the
total is reached, so put the topic you care about most first.

Numbers come back exactly as YouTube prints them, as text: `115,768,253 views`, `3 months ago`,
`4:21`. That is deliberate. YouTube never publishes a real timestamp on a search result, only a
phrase, and parsing "3 months ago" into a date would be inventing precision that was never there.

A video that appears under two of your topics is returned once and counted once.

### 📋 What data you get from each top YouTube video

| What you get | Field |
|---|---|
| The 11 character video id and the watch link | `videoId`, `url` |
| Title | `title` |
| Who uploaded it | `channelName`, `channelId` |
| Views, as YouTube prints them | `viewCountText` |
| How long ago it went up | `publishedTimeText` |
| Duration | `lengthText` |
| The largest thumbnail on offer | `thumbnail` |
| Always `trending` here, so rows merge with the other YouTube scrapers | `mode` |

### ▶️ How to scrape the most-viewed YouTube videos for a topic

1. Open [YouTube Trending Scraper](https://apify.com/dami_studio/youtube-trending-scraper) and
   click **Try for free**.
2. Type your topics into **Topics / keywords**, one per line, most important first.
3. Set **Max videos** low while you are testing, since that is what you pay for.
4. Click **Start**.
5. Download the dataset as JSON, CSV or Excel, or pull it from the Apify API.

### 💰 How much does it cost to scrape the most-viewed YouTube videos?

**$0.40 per 1,000 videos** on the Free plan. Paid plans pay a little less: $0.395 on Starter, $0.39 on Scale and $0.385 on Business. On the free plan, the $5
Apify gives you each month covers about 12,500 videos.

You pay per video returned, so the bill follows **Max videos** rather than how many topics you
typed. A video found under two topics counts once. Diagnostic rows are not charged, and a topic that
returns nothing adds nothing to the bill.

### 📥 What you give it

```json
{
  "keywords": ["music", "gaming", "ai"],
  "maxItems": 100
}
```

| Field | Default | What it is |
|---|---|---|
| `keywords` | none | One topic per line, most important first. With an empty list you get one uncharged `BAD_INPUT` row and nothing is searched. The form opens with `music` as an example. |
| `maxItems` | `50` | Total videos across every topic, not per topic. Up to 2,000. This is what you pay for. |
| `proxyConfiguration` | none | Optional. Leave it empty unless you have your own servers you want the traffic to leave through. |
| `notionConnector` | none | Optional. Deliver the rows to a Notion workspace you have connected to Apify. |
| `notionParentId` | none | The Notion database to write them into, when you use the connector. |

### 📤 What you get back

A real row from a real run. The thumbnail link is cut short so the block stays readable:

```json
{
  "ok": true,
  "videoId": "OQac93ARgQE",
  "title": "TUL8TE, Saint Levant - Nano I تووليت، ساينت ليفانت - نانو (Official Music Video)",
  "url": "https://www.youtube.com/watch?v=OQac93ARgQE",
  "channelName": "TUL8TE",
  "channelId": "UC5a1OK2lI0Q2x2jyJSDyc7A",
  "viewCountText": "115,768,253 views",
  "publishedTimeText": "3 months ago",
  "lengthText": "4:21",
  "thumbnail": "https://i.ytimg.com/vi/OQac93ARgQE/hq720.jpg?sqp=...",
  "mode": "trending"
}
```

| Field | How to read it |
|---|---|
| `videoId` | It survives a title change, so key on it rather than the URL. |
| `viewCountText` | What YouTube printed. On a live stream it reads `N watching` instead of a view count. |
| `publishedTimeText` | YouTube's own phrase, like `3 months ago`. Empty on a live stream, which has not been published yet. |
| `lengthText` | Duration as shown, `4:21`. Live streams have none. |
| `channelId` | The `UC...` id, or an empty string when the byline is a collaboration rather than one channel. Measured at 41 of 45 rows carrying an id on one run. |
| `thumbnail` | Signed and time limited, so download what you want to keep. |

### 🧾 Reading the output

| Row | How to spot it | Billed |
|---|---|---|
| A video | `ok: true` with a `videoId` | yes |
| A diagnostic | `ok: false` with an `errorCode` and the topic it belongs to | no |

Filter on `ok == true` and you have your data. A diagnostic row does not stop the run. The other
topics carry on.

| Code | What it means |
|---|---|
|`RATE_LIMITED`, `SERVER_ERROR`, `NETWORK` | That topic would not answer this run. Re-running usually clears it. |
| `NOT_SERVED` | This video was not served this run. Re-run it later. Runs before 13 October 2026 wrote `BLOCKED` here, and runs from 13 to 17 October wrote `NETWORK`. |
| `NOT_FOUND` | The search came back as not found. |
| `NO_RESULTS` | The search worked and that topic had nothing to return. |
| `BAD_INPUT` | No topics were given, so there was nothing to search. |
| `TIME_LIMIT` | The run got close to its time limit and stopped on its own. The videos delivered before that are in the dataset and charged as usual. Give the run more time, or ask for fewer videos, to get the rest. |

A run still ends as succeeded, with an amber status message, even when the time limit stopped it before any video came back.

### 💡 What people use it for

- Sizing a niche before making anything: what does the top of this topic actually look like, and how
  big are the numbers.
- Finding the channels that own a subject, by grouping rows on `channelName`.
- Filling a content calendar with formats that already worked, rather than guesses.
- Checking the same topics week to week. The ranking moves slowly, so weekly tells you more than
  hourly.

From a topic to the channels that own it, in three runs:

1. Run this on your topic and group the rows on `channelName`.
2. Paste the strongest channels into the **Channels** box of
   [YouTube Channel Scraper](https://apify.com/dami_studio/youtube-channel-scraper) to see how often
   they post and what.
3. Put the `url` of the top videos into the **Video URLs or IDs** box of
   [YouTube Transcript Scraper](https://apify.com/dami_studio/youtube-transcript-scraper) to study
   what they say.

### 🚧 What it does not do

- **It is not this week's trending.** The ranking is all-time views for the topic. YouTube retired
  the feed that would have answered the other question.
- **No description, no like count, no comment count.** The search results do not carry them. Pull
  those separately if you need them.
- **No dates.** `publishedTimeText` is YouTube's phrase, not a timestamp, and nothing here turns one
  into the other.
- **News-shaped topics come back full of live streams**, which have `N watching` where the view
  count goes and no publish date or duration at all.
- **A collaboration byline leaves `channelId` empty**, because YouTube gives that row no single
  channel to point at. `channelName` still fills in.
- **2,000 videos per run**, and `maxItems` counts across every topic together.
- **If YouTube answers a sorted request in relevance order anyway**, the rows come back in that order
  and nothing on the row flags it.
- It is not an official YouTube tool. Dami's Studio is independent and is not affiliated with or endorsed by YouTube or Google, or by any other company named on this page.

### 🧭 Which YouTube scraper do you need?

| If you want | Use |
|---|---|
| The most-viewed videos for a topic | This one |
| A keyword search in YouTube's own order, or a channel's newest uploads | [YouTube Scraper](https://apify.com/dami_studio/youtube-scraper) |
| Shorts from a channel or a keyword, with exact view and like counts | [YouTube Shorts Scraper](https://apify.com/dami_studio/youtube-shorts-scraper) |
| Only the new uploads since your last check | [YouTube Upload Monitor](https://apify.com/dami_studio/youtube-channel-monitor) |
| What a video says, as text, SRT and VTT | [YouTube Transcript Scraper](https://apify.com/dami_studio/youtube-transcript-scraper) |
| Comments under a video | [YouTube Comments Scraper](https://apify.com/dami_studio/youtube-comments-scraper) |
| The video, its audio or its subtitles as a file | [YouTube Downloader Pro](https://apify.com/dami_studio/youtube-video-downloader) |
| What people are searching for right now, from Google Trends | [Google Trends Scraper](https://apify.com/dami_studio/google-trends-scraper) |

### ❓ Questions people ask

#### Do I need a YouTube API key?

No. No key, no OAuth, no quota to manage.

#### Why is a three-month-old video at the top?

Because the sort is total views, and an older video has had longer to collect them. That is what
"most viewed for this topic" means here.

#### Can I get exact numbers instead of text?

Not from this one. `viewCountText` carries the digits YouTube printed, so `115,768,253 views` parses
cleanly enough, but the age never will.

#### Does it cover a country or a language?

Not as a setting. Phrase the topic in the language you want and you mostly get that language back.

#### Can I call it from code or connect it to an AI assistant?

The [API tab](https://apify.com/dami_studio/youtube-trending-scraper/api/python) has code for Python, JavaScript and
the CLI. MCP clients like Claude and ChatGPT use
`https://mcp.apify.com/?tools=fetch-actor-details,dami_studio/youtube-trending-scraper`; coding assistants can load
[our skill file](https://api.apify.com/v2/key-value-stores/BTBHU3DdiuoF4JOsK/records/apify-youtube-SKILL.md). All
three bill your Apify account at the same price.

#### Is scraping YouTube legal?

This reads public search results, the same ones a signed-out visitor sees. Apify's write-up on
[the legality of web scraping](https://blog.apify.com/is-web-scraping-legal/) is a reasonable
starting point, and we are not lawyers.

### 🆘 If something breaks

Open the **Issues** tab on the actor page. Include the topics you used and the run ID. Any
diagnostic rows in your dataset already name the reason.

# Actor input Schema

## `keywords` (type: `array`):

Topics to find the most-viewed (trending) videos for.

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

Max videos to collect. Charged per video.

## `proxyConfiguration` (type: `object`):

Optional. Leave this alone unless you need the run to go out through a particular network. Your own proxy servers are used exactly as given.

## `notionConnector` (type: `string`):

Optional. Deliver results to your connected Notion via Apify MCP connectors.

## `notionParentId` (type: `string`):

Optional Notion database/data-source id.

## Actor input object example

```json
{
  "keywords": [
    "music",
    "gaming",
    "ai"
  ],
  "maxItems": 50
}
```

# Actor output Schema

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

Videos in the default dataset.

# 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 = {
    "keywords": [
        "music"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("dami_studio/youtube-trending-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 = { "keywords": ["music"] }

# Run the Actor and wait for it to finish
run = client.actor("dami_studio/youtube-trending-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 '{
  "keywords": [
    "music"
  ]
}' |
apify call dami_studio/youtube-trending-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dami_studio/youtube-trending-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/oq2AY65GnoN6VcU3o/builds/OddDOMPbryoAeCX7E/openapi.json
