# YouTube Scraper | Videos, Channels, Shorts & Comments (`genial_candlestand/youtube-scraper`) Actor

Get YouTube videos with exact views, likes, publish date, description and chapters, channels with subscribers, country, joined date and links, playlists and top comments. Search terms by country and filters, or channel, playlist and video URLs. No login or API key.

- **URL**: https://apify.com/genial_candlestand/youtube-scraper.md
- **Developed by:** [Flowo](https://apify.com/genial_candlestand) (community)
- **Categories:** Social media, Lead generation, AI
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.23 / 1,000 results

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 Scraper | Videos, Channels, Shorts & Comments

![YouTube Scraper | Videos, Channels, Shorts & Comments](https://api.apify.com/v2/key-value-stores/Ll7RrWtDkZYOrBvfE/records/youtube-com-all-in-one-platform-scraper-banner-807a6e82.png)

Get public YouTube data as flat rows: videos, Shorts and streams with exact view count, like count, publish date, full description, comment count, hashtags and chapters; channels with subscriber count, country, joined date, total views and external links; playlists; and the top comments of every video. Use search terms (with a country, upload date, length and sort filter), channel, playlist and video URLs, or both in one run. No login, cookies or API key.

### What does YouTube Scraper do?

You give it YouTube search terms and/or YouTube URLs. It returns one row per item, and the `type` field tells the row kinds apart: `video` (also Shorts and live or past streams), `channel`, `playlist` and `comment`. A channel URL gives a channel row with its About panel plus the videos, Shorts or streams of the tabs you pick; a video URL gives one video row, plus its top comments when you ask for them.

It is built for marketers and agencies (influencer and competitor research, channel lead lists), media and research analysts (keyword and trend monitoring by country, comment sentiment), AI and RAG builders (descriptions, chapters and comments as text) and developers who need one YouTube source for videos, channels and comments.

### How to scrape YouTube videos, channels and comments

![How YouTube Scraper works: Calls YouTube's own InnerTube JSON API, the one youtube.com uses; Pages through search results, channel tabs and playlists up to your limit; Adds exact stats, video page det](https://api.apify.com/v2/key-value-stores/Ll7RrWtDkZYOrBvfE/records/youtube-com-all-in-one-platform-scraper-how-8b931f04.png)

1. Open the actor in Apify Console.
2. Enter **Search terms** (one per line), **YouTube URLs**, or both.
3. For search terms, pick the **Search result type** (Videos, Shorts, Channels, Playlists or Everything) and optional filters: **Sort search by**, **Upload date**, **Video length** and **Country**.
4. For channel URLs, choose the **Channel tabs** (Videos, Shorts, Live).
5. Set **Max results per input**, **Video details** and, if you want comments, **Max comments per video**.
6. Click **Start**. When the run ends, download the rows as JSON, CSV or Excel, or read them through the API.

### How much does it cost to scrape YouTube?

Price per event by Apify plan:

| Event | Free | Bronze | Silver | Gold and above |
|---|---|---|---|---|
| Result | $1.45 per 1,000 | $1.377 per 1,000 | $1.305 per 1,000 | $1.232 per 1,000 |
| Actor start | $0.00005 | $0.00005 | $0.00005 | $0.00005 |

A test run with the API example input below returned 22 rows in 27 s.

One paid event is **one row saved to the dataset**: a video, a channel, a playlist or a comment, all at the same price. Channel About details, Full video details and the tags/category add-on are included in the row price. Inputs that are not found and requests that fail produce no row and cost nothing. The actor-start event is charged once per run (the default memory is 256 MB).

Cost scenarios on the Free plan ($0.00145 per row plus $0.00005 per run start):

| Scenario | Rows (events) | Cost on Free plan |
|---|---|---|
| Default input: 20 search videos, 1 channel with 20 videos, 1 video URL | 42 | ≈ $0.061 |
| 100 most-viewed videos of the month for a search term in Germany | 100 | ≈ $0.145 |
| 2 video URLs with up to 200 top comments each | 402 | ≈ $0.583 |
| 1,000 rows of any type | 1,000 | ≈ $1.45 |

### Input

![YouTube Scraper input example: Search terms, YouTube URLs, Search result type, Sort search by, Upload date, Video length, Country](https://api.apify.com/v2/key-value-stores/Ll7RrWtDkZYOrBvfE/records/youtube-com-all-in-one-platform-scraper-input-0f62c6d4.png)

Give at least one search term in `queries` or one URL in `startUrls`.

| Field | What it does |
|---|---|
| `queries` | YouTube search terms, one per line. |
| `startUrls` | Channel URLs (`@handle`, `/channel/UC…`, `/c/…`, `/user/…`, also with a `/videos`, `/shorts` or `/streams` suffix), playlist URLs (`/playlist?list=…`), video URLs (`watch?v=`, `youtu.be/`, `/shorts/`, `/live/`) or search URLs (`/results?search_query=…`). A bare `@handle`, an 11-character video id or a `UC…` channel id works too. Hashtag URLs run as a search for `#tag`. |
| `searchType` | What search terms return: `video` (default), `shorts`, `channel`, `playlist` or `all` (YouTube's mixed list). |
| `sortBy` | `relevance` (default) or `viewCount` (most viewed). Not for Shorts. Sorting by upload date is not offered because YouTube ignores it. |
| `uploadDate` | `any` (default), `hour`, `today`, `week`, `month`, `year`. Only with search type `video` or `all`. |
| `duration` | `any` (default), `short` (under 4 minutes), `medium` (4–20 minutes), `long` (over 20 minutes). Only with search type `video` or `all`. |
| `country` | Two-letter code (e.g. `US`, `DE`, `JP`) or English country name YouTube ranks search results for; default `US`. It must be a country YouTube supports (e.g. `CU` or `KP` stop the run with an input error). Texts stay in English. |
| `channelTabs` | Tabs to list per channel URL: `videos` (default), `shorts`, `streams` (Live). Empty = only the channel row. A URL tab suffix (`/@x/shorts`) uses that tab. |
| `maxResultsPerInput` | 1–10,000, default 20. Max video, channel or playlist rows per search term, per channel tab and per playlist. The channel row and comments are not counted. |
| `videoDetails` | `full` (default): description, exact views and likes, date, channel subscribers, comment count, hashtags, chapters. `stats`: exact views, likes and date. `basic`: the list as shown (rounded views, "3 days ago"), fastest. Video URLs always get Full. |
| `maxCommentsPerVideo` | 0–10,000, default 0. Top comments saved per video (each comment is a row), for video URLs and every listed video. Replies are not saved, only their count. |
| `includeChannelAbout` | Default on. Adds country, joined date, exact total views and video count, external links and the business-email flag to channel rows. |
| `includePlayerData` | Default off. Adds tags, category, exact publish time, length in seconds, family-safe and unlisted flags to every video row. Needs the RESIDENTIAL proxy group. |
| `maxItems` | Stops the whole run after this many rows of every type. Empty = no total limit. |
| `proxyConfiguration` | Apify datacenter proxy by default; RESIDENTIAL for `includePlayerData`. |

Example input (a channel audit):

```json
{
  "startUrls": [
    { "url": "https://www.youtube.com/@mkbhd" },
    { "url": "https://www.youtube.com/@MrBeast" }
  ],
  "channelTabs": ["videos", "shorts"],
  "maxResultsPerInput": 30,
  "videoDetails": "full",
  "includeChannelAbout": true
}
```

### What data can you extract from YouTube?

![YouTube Scraper output example: Type, Image, Title, Channel, Views, Likes](https://api.apify.com/v2/key-value-stores/Ll7RrWtDkZYOrBvfE/records/youtube-com-all-in-one-platform-scraper-output-9629b65f.png)

Every row has `type`, `id`, `url` and `scrapedAt`, plus `query` (search rows) or `inputUrl` (URL rows) and `position` (rank in its list).

| Row type | Fields |
|---|---|
| `video` | `title`, `channelName`, `channelId`, `channelUrl`, `channelVerified`, `channelSubscriberCount`, `description`, `descriptionSnippet`, `viewCount`, `watchingCount`, `likeCount`, `commentCount`, `commentsOff`, `publishedAt`, `publishedTimeText`, `durationSeconds`, `durationText`, `isLive`, `isShort`, `imageUrl`, `hashtags`, `chapters`, `playlistId`, `playlistTitle`; with tags/category on: `tags`, `category`, `isFamilySafe`, `isUnlisted` |
| `channel` | `title`, `channelName`, `channelId`, `channelUrl`, `channelVerified`, `handle`, `description`, `subscriberCount`, `videoCount`, `viewCount` (total views), `country`, `joinedAt`, `links`, `hasBusinessEmail`, `tags` (channel keywords), `isFamilySafe`, `imageUrl` (avatar), `bannerUrl` |
| `playlist` | `title`, `channelName`, `videoCount`, `imageUrl` |
| `comment` | `videoId`, `text`, `author`, `authorChannelId`, `authorUrl`, `authorIsChannelOwner`, `likeCount`, `replyCount`, `isHearted`, `isEdited`, `publishedTimeText` |

`hashtags`, `chapters`, `tags` and `links` are arrays of strings. Chapters look like `"1:22 Design and comfort approach"`.

A real video row from a channel URL (description shortened):

```json
{
  "type": "video",
  "id": "_x58r9TBois",
  "url": "https://www.youtube.com/watch?v=_x58r9TBois",
  "title": "Meta VR Glasses: What Vision Pro 2 COULD Have Been!",
  "query": null,
  "inputUrl": "https://www.youtube.com/@mkbhd",
  "position": 1,
  "channelName": "Marques Brownlee",
  "channelId": "UCBJycsmduvYEL83R_U4JriQ",
  "channelUrl": "https://www.youtube.com/@mkbhd",
  "channelVerified": true,
  "channelSubscriberCount": 21400000,
  "description": "Meta's new headset is an ultra light hybrid headset that reminds me...",
  "viewCount": 6477572,
  "likeCount": 64515,
  "commentCount": 3875,
  "commentsOff": false,
  "publishedAt": "2026-11-06",
  "publishedTimeText": "4 days ago",
  "durationSeconds": 481,
  "durationText": "8:01",
  "isLive": false,
  "isShort": false,
  "imageUrl": "https://i.ytimg.com/vi/_x58r9TBois/hq720.jpg",
  "hashtags": [],
  "chapters": ["0:00 Introduction to Meta glasses", "1:22 Design and comfort approach", "7:21 Final thoughts and conclusion"],
  "scrapedAt": "2026-11-11T04:42:28.165Z"
}
```

A real channel row from the same run (shortened):

```json
{
  "type": "channel",
  "id": "UCBJycsmduvYEL83R_U4JriQ",
  "url": "https://www.youtube.com/channel/UCBJycsmduvYEL83R_U4JriQ",
  "title": "Marques Brownlee",
  "inputUrl": "https://www.youtube.com/@mkbhd",
  "handle": "@mkbhd",
  "subscriberCount": 21400000,
  "videoCount": 1865,
  "viewCount": 5889255869,
  "country": "US",
  "joinedAt": "2008-03-21",
  "links": ["http://twitter.com/MKBHD", "http://instagram.com/MKBHD", "http://discord.gg/MKBHD"],
  "hasBusinessEmail": true,
  "scrapedAt": "2026-11-11T04:42:06.899Z"
}
```

### Use cases

- **Keyword research by country**: the 100 most-viewed videos of the month for "electric cars review" in Germany, with exact views, likes, date, description, channel and subscribers.
- **Channel audit and influencer lists**: one channel row (country, joined date, total views, links) plus the latest videos and Shorts of each channel.
- **Channel lead lists from a search**: channel search for a topic returns channel rows with subscribers, country, links and the business-email flag.
- **Comments for sentiment analysis**: the top comments of chosen videos, or of every video a search or channel returns, in the same run.
- **Playlist and Shorts exports**: every video of a playlist with `playlistId` and `playlistTitle`, or Shorts for a search term.

### Limitations

- No transcripts or subtitles, no AI summaries, no comment replies (only `replyCount`) and no "newest first" comment sort.
- YouTube ends a search after about 450 results per search term and filter set.
- `subscriberCount`, `channelSubscriberCount` and comment `likeCount` are rounded the way YouTube shows them (21.4M → 21400000). Video views and likes are exact with Stats or Full details; Basic lists of channels and Shorts give rounded views.
- `viewCount` is null for live and upcoming streams (live ones have `watchingCount`). `commentCount` is null when comments are off.
- `country` comes from the channel's About panel and is often empty: many channels do not set it.
- `hasBusinessEmail` only says whether a business email exists; the address needs a login and is never collected.
- Tags and category on datacenter IPs: YouTube withholds them for about 40% of videos; use the RESIDENTIAL proxy group.
- `isHearted` is not reliable in the current version: it can be true on comments the creator did not heart.
- Age-restricted, members-only and private videos were not tested; such rows carry only what YouTube still shows, with missing fields null.

### Tips and troubleshooting

- **Input error before the run starts?** Shorts search takes no sort or filters; channel and playlist search take only `sortBy`; `uploadDate` and `duration` work only with search type `video` or `all`. An unknown or unsupported country also stops the run.
- **Only channel rows, no videos**: set `searchType: "channel"` for a search, or `channelTabs: []` for channel URLs.
- **Faster and cheaper runs**: `videoDetails: "basic"` skips the per-video requests; `stats` gives exact views, likes and date without the description.
- **Fewer rows than expected?** Check the run log: not-found handles, videos and playlists, missing channel tabs and YouTube mixes (`list=RD…`) are logged as warnings and skipped, and the run still succeeds.
- **Search filters on URL-only runs**: sort and filters apply only to search terms and search URLs; a search URL with its own `sp=` filter keeps that filter.
- **Cap the bill**: `maxItems` stops the whole run after that many rows, comments included.

### API, MCP and integrations

Run the actor from your code with the same JSON input as in Console. Your API token is in [Console → Settings → API & Integrations](https://console.apify.com/settings/integrations).

**Python** (`pip install apify-client`):

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("genial_candlestand/youtube-scraper").call(run_input={
    "queries": ["lofi hip hop"],
    "startUrls": [
        {"url": "https://www.youtube.com/@mkbhd"},
        {"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"},
    ],
    "maxResultsPerInput": 10,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

**Node.js** (`npm install apify-client`):

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('genial_candlestand/youtube-scraper').call({
    "queries": ["lofi hip hop"],
    "startUrls": [
        {"url": "https://www.youtube.com/@mkbhd"},
        {"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"},
    ],
    "maxResultsPerInput": 10,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

**HTTP** — one request runs the actor and returns the results (runs up to 5 minutes; longer ones: [run asynchronously](https://docs.apify.com/api/v2/act-runs-post)):

```bash
curl -X POST "https://api.apify.com/v2/acts/genial_candlestand~youtube-scraper/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"queries":["lofi hip hop"],"startUrls":[{"url":"https://www.youtube.com/@mkbhd"},{"url":"https://www.youtube.com/watch?v=dQw4w9WgXcQ"}],"maxResultsPerInput":10}'
```

**AI agents (MCP).** Add the actor as a tool of the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp). Claude Code:

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=genial_candlestand/youtube-scraper"
```

Claude Desktop, Cursor or VS Code: `{"mcpServers": {"apify": {"url": "https://mcp.apify.com?tools=genial_candlestand/youtube-scraper"}}}`. Then ask, for example:

- "Find the 100 most-viewed electric cars review videos uploaded this month in Germany"
- "Get the channel About details and latest 30 videos and Shorts of @mkbhd and @MrBeast"
- "Collect 200 top comments of https://www.youtube.com/watch?v=dQw4w9WgXcQ for sentiment analysis"

**Integrations.** Run it on a schedule with [Apify Schedules](https://docs.apify.com/platform/schedules) and send the results to Google Sheets, Slack, Zapier, Make, n8n or your webhook — see [Apify integrations](https://docs.apify.com/platform/integrations).

### FAQ

**Is it legal to scrape YouTube?**<br>
The actor collects only public data that YouTube shows to any visitor without a login. You are responsible for how you use it; check YouTube's terms and the data protection rules that apply to you, especially for commenter names and handles.

**Do I need a YouTube API key or an account?**<br>
No. It needs no login, cookies or API key, and the default Apify datacenter proxy works for everything except the tags/category add-on.

**Can I scrape a single video?**<br>
Yes. One video URL or 11-character video id gives one video row with Full details; there is no minimum number of videos per input.

**How is it different from other YouTube actors?**<br>
Videos, channels with their About panel, channel and playlist search, playlists and top comments come from one actor in one run, at one price per row of any type: $1.45 per 1,000 rows on the Free plan, against $4.00 per 1,000 videos for the most-used YouTube scraper in the Store.

**Does the country setting change the language?**<br>
No. `country` changes which results YouTube ranks for search terms; the request language stays English (dates, labels and counts are read in English).

**Are comments charged differently?**<br>
No. Every row costs the same, whether it is a video, a channel, a playlist or a comment.

### Also useful

- [YouTube Comments Scraper](https://apify.com/genial_candlestand/youtube-comments-and-replies-scraper) — get full comment threads with replies when the top comments are not enough
- [YouTube Transcript Scraper](https://apify.com/genial_candlestand/youtube-transcript-scraper) — add captions and subtitles of the same videos for AI, RAG or text analysis
- [YouTube Channel Scraper](https://apify.com/genial_candlestand/youtube-channel-details-videos-scraper) — track channel details, videos, Shorts and streams with a channel-only tool
- [YouTube Search Scraper](https://apify.com/genial_candlestand/youtube-search-scraper) — run keyword searches for videos, Shorts and channels with view counts
- [Google Trends Scraper](https://apify.com/genial_candlestand/google-trends-scraper) — check search interest by region and related queries for your video keywords

# Actor input Schema

## `queries` (type: `array`):

YouTube search terms, one per line. Each term returns up to 'Max results per input' rows of the type chosen in 'Search result type'. Give search terms, YouTube URLs or both.

## `startUrls` (type: `array`):

Channel URLs (@handle, /channel/UC…, /c/…, /user/…, also with a /videos, /shorts or /streams suffix), playlist URLs (/playlist?list=…), video URLs (watch?v=, youtu.be/, /shorts/, /live/) or search URLs (/results?search_query=…). A bare @handle, 11-character video id or UC… channel id works too. Hashtag URLs run as a search for #tag.

## `searchType` (type: `string`):

What 'Search terms' return: videos, Shorts, channels, playlists or YouTube's mixed list. Shorts search takes no sort or filters; channel and playlist search take only 'Sort search by'.

## `sortBy` (type: `string`):

Order of search results. 'Most viewed' works for videos, channels, playlists and everything, not for Shorts. Sorting by upload date is not offered: YouTube ignores it.

## `uploadDate` (type: `string`):

Only search results uploaded in this period. Works only when 'Search result type' is Videos or Everything.

## `duration` (type: `string`):

Only search results of this length: under 4 minutes, 4–20 minutes or over 20 minutes. Works only when 'Search result type' is Videos or Everything.

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

Two-letter code (e.g. US, DE, JP) or English country name YouTube ranks search results for. It must be a country YouTube supports; others (e.g. CU, KP) stop the run with an input error. Texts stay in English.

## `channelTabs` (type: `array`):

Which tabs of each channel URL to list: Videos, Shorts, Live (past and current streams). Leave empty to get only the channel row. A URL with its own tab suffix (/@x/shorts) uses that tab.

## `maxResultsPerInput` (type: `integer`):

Max video, channel or playlist rows per search term, per channel tab and per playlist (1–10,000). YouTube ends a search after about 450 results. The channel row and comments are not counted.

## `videoDetails` (type: `string`):

How much to fetch per listed video. Full: description, exact views and likes, date, subscribers, comment count, hashtags, chapters. Stats: exact views, likes and date. Basic: the list as shown (rounded views, '3 days ago'), fastest. Video URLs always get Full.

## `maxCommentsPerVideo` (type: `integer`):

Top comments to save per video, each as its own row, for video URLs and every listed video (0–10,000; 0 = no comments). Replies are not saved, only their count.

## `includeChannelAbout` (type: `boolean`):

Add the channel's About panel to channel rows: country, joined date, exact total views and video count, external links and whether a business email exists (the address itself needs a login and is never collected).

## `includePlayerData` (type: `boolean`):

Add tags, category, exact publish time, length in seconds, family-safe and unlisted flags to every video row (one extra request per video). Needs the RESIDENTIAL proxy group: on datacenter IPs YouTube withholds these fields for about 40% of videos.

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

Stop the whole run after this many rows of every type: videos, channels, playlists and comments. Empty = no total limit.

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

Apify datacenter proxy works for everything except 'Tags, category and exact publish time', which needs the RESIDENTIAL group.

## Actor input object example

```json
{
  "queries": [
    "lofi hip hop"
  ],
  "startUrls": [
    {
      "url": "https://www.youtube.com/@mkbhd"
    },
    {
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    }
  ],
  "searchType": "video",
  "sortBy": "relevance",
  "uploadDate": "any",
  "duration": "any",
  "country": "US",
  "channelTabs": [
    "videos"
  ],
  "maxResultsPerInput": 20,
  "videoDetails": "full",
  "maxCommentsPerVideo": 0,
  "includeChannelAbout": true,
  "includePlayerData": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

Dataset with every row (videos, channels, playlists, comments); the type field tells them apart

## `videos` (type: `string`):

Video rows in the Videos view

## `channels` (type: `string`):

Channel rows in the Channels view

## `comments` (type: `string`):

Comment rows in the Comments view

# 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 = {
    "queries": [
        "lofi hip hop"
    ],
    "startUrls": [
        {
            "url": "https://www.youtube.com/@mkbhd"
        },
        {
            "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("genial_candlestand/youtube-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 = {
    "queries": ["lofi hip hop"],
    "startUrls": [
        { "url": "https://www.youtube.com/@mkbhd" },
        { "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" },
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("genial_candlestand/youtube-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 '{
  "queries": [
    "lofi hip hop"
  ],
  "startUrls": [
    {
      "url": "https://www.youtube.com/@mkbhd"
    },
    {
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    }
  ]
}' |
apify call genial_candlestand/youtube-scraper --silent --output-dataset

```

## MCP server setup

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