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

YouTube Scraper and YouTube API alternative: scrape videos, Shorts, live streams, channels, playlists, hashtags and search results, with comments, replies, subtitles/captions (transcripts) and chapters. Export JSON, CSV, Excel. No login, no API key, no quota. $0.40 per 1,000 videos.

- **URL**: https://apify.com/socialscrapers/youtube-scraper.md
- **Developed by:** [Social Scrapers](https://apify.com/socialscrapers) (community)
- **Categories:** Videos, Social media, Marketing
- **Features:** Limited permissions
- **Stats:** 3 total users, 3 monthly users, 87.5% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.32 / 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 Scraper** extracts public YouTube data: **videos, Shorts, live streams, channels, playlists, hashtags, search results, comments, replies and subtitles**. Start from search terms, hashtags or any YouTube URL, and download clean JSON, CSV or Excel. Every video comes with its exact views, likes and comment count, tags, category, chapters, publish date and duration, plus the channel's subscribers. It works as a **YouTube API alternative with no API key, no quota and no login**, from **$0.40 per 1,000 videos**.

### What does YouTube Scraper do?

YouTube Scraper turns YouTube pages into structured data you can download, schedule or call from your own code:

- 🔎 **Search YouTube** with YouTube's own filters: result type (videos, Shorts, live, movies or channels), upload date, duration, features (4K, HD, Subtitles/CC, Creative Commons, Live, 360°, VR180, 3D, HDR, Location, Purchased), and relevance or popularity order.
- \#️⃣ **Scrape YouTube hashtags**: give `#sourdough` or `https://www.youtube.com/hashtag/sourdough` and get the videos or Shorts under it.
- 📺 **Scrape YouTube channels** by URL or @handle: videos, Shorts and live streams, each with its own limit, in Latest, Popular or Oldest order, plus the channel's details (subscribers, total views and videos, join date, country, links, avatar, banner).
- 📃 **Scrape playlists, single videos and Shorts** by URL or ID.
- 💬 **Scrape YouTube comments and replies**: top comments or newest first, with likes, reply counts, and pinned, edited and creator-heart flags.
- 📝 **Download YouTube subtitles and captions** with each video: the creator's or automatic ones, in your languages or all of them, as SRT, WebVTT, plain text or XML.
- 📅 **Date range**: only videos published after or before a date (`2026-01-31`, `31/01/2026`, `Jan 31 2026`), or within an age such as `30 days`, `2w` or `6 months`, across searches, channels, playlists and hashtags.
- 📊 **Exact numbers and hidden data**: exact view, like and comment counts, the creator's tags and category (which YouTube's page hides), chapters, and the "Includes paid promotion" flag.
- ♾️ **No upper limits**: ask for 10 videos or a whole channel; the scraper reads as far as YouTube lists.
- ✅ **Each video once per run**, even when several inputs find it, and **you pay only for results**. Set a maximum cost per run and it stops cleanly there.

### What data can you extract from YouTube?

| Item | Data you get |
| --- | --- |
| **Video** (also Shorts and live streams) | title, description, URL, publish date and time, duration, exact views, likes and comment count, tags, hashtags, category, thumbnail, chapters, video type (video, Short or stream), live status, members-only, age-restricted, unlisted, family-safe, paid promotion, links in the description, subtitles |
| **Channel of each video** | channel name, @handle, URL and ID, subscribers, verified badge |
| **Comment and reply** | text, author and author channel, likes, reply count, date, edited, pinned, creator heart, written by the creator, parent comment |
| **Channel details** | name, @handle, description, subscribers, total videos, total views, country, join date, links, keywords, avatar, banner, verified badge |
| **Where it was found** | input type (search, hashtag, channel, playlist or URL), input URL, search term, rank in the list |

### How to scrape YouTube

1. Open YouTube Scraper on Apify and click **Try for free**.
2. Enter **search terms**, **hashtags** or **YouTube URLs**: videos, Shorts, channels, channel tabs, playlists, hashtag pages or search pages.
3. Set how many results you want per search term or hashtag, and per channel or playlist. Shorts and live streams of a channel have their own limits.
4. Optionally add filters (upload date, duration, features, result type), a date range, the channel order, comments, subtitles or channel details.
5. Click **Start**. When the run finishes, download the results as JSON, CSV, Excel, XML or HTML, or read them through the API.

#### How to scrape a YouTube channel

Paste the channel URL or @handle, for example `https://www.youtube.com/@NASA`. Set **Max videos per channel**, and **Max Shorts per channel** or **Max live streams per channel** if you want those too. Pick **Latest**, **Popular** or **Oldest** to choose which videos come first, and switch on **Save channel details** for the channel's profile. To scrape only one tab, paste its URL, such as `https://www.youtube.com/@NASA/shorts`.

#### How to scrape YouTube comments

Add the videos (or a channel, search or playlist), switch on **Save comments**, and set **Max comments per video** and **Max replies per comment**. Each video is saved first, followed by its comments, so they are easy to group.

#### How to download YouTube subtitles

Switch on **Save subtitles**, list your languages in order of preference (for example `en`, `es`), and pick a format: **SRT**, **WebVTT**, **plain text** or **XML**. Each video gets the first of your languages it has, with the creator's subtitles preferred over automatic ones, or every language when **Every subtitle language** is on. For transcripts only, without the other video data, see YouTube Transcript Scraper below.

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

YouTube Scraper is pay-per-result: you pay only for what is saved. There is no monthly fee for the Actor, and platform usage and proxies are included.

| Result | Price per 1,000 | Silver plan | Gold plan |
| --- | --- | --- | --- |
| Videos (Shorts and live streams included) | **$0.40** | $0.36 | $0.32 |
| Comments (replies included) | **$0.20** | $0.18 | $0.16 |
| Channel details | **$0.30** | $0.27 | $0.24 |
| Subtitles (per video, only with Save subtitles on) | **$0.30** | $0.27 | $0.24 |

Examples:

- **1,000 videos** from a search or a channel: **$0.40**.
- **500 videos with 100 comments each** (50,000 comments): $0.20 + $10.00 = **$10.20**.
- **1,000 videos with English subtitles**: $0.40 + $0.30 = **$0.70**.

Apify's free plan comes with $5 of platform credit every month, enough to try YouTube Scraper on about 12,000 videos. Videos, comments and channels that cannot be read are never charged. To cap a run's cost, set **Maximum cost per run** in the run options: the scraper stops cleanly before the first result that would go over it.

### Input example

```json
{
  "searchQueries": ["sourdough bread recipe"],
  "maxResultsPerQuery": 200,
  "searchType": "video",
  "uploadDate": "month",
  "features": ["4k", "subtitles"],
  "sortBy": "popularity",
  "hashtags": ["sourdough"],
  "startUrls": [
    { "url": "https://www.youtube.com/@NASA" },
    { "url": "https://www.youtube.com/playlist?list=PLAYLIST_ID" },
    { "url": "https://www.youtube.com/watch?v=VIDEO_ID" }
  ],
  "maxVideosPerChannel": 100,
  "maxShortsPerChannel": 20,
  "channelSortBy": "popular",
  "publishedAfter": "2026-01-01",
  "includeChannelInfo": true,
  "includeComments": true,
  "maxCommentsPerVideo": 100,
  "maxRepliesPerComment": 5,
  "downloadSubtitles": true,
  "subtitlesLanguages": ["en"],
  "subtitlesFormat": "srt"
}
```

Supported URLs: videos (`/watch?v=`, `youtu.be/`, `/live/`, `/embed/`), Shorts (`/shorts/`), channels (`/@handle`, `/channel/UC…`, `/c/…`, `/user/…`), channel tabs (`/videos`, `/shorts`, `/streams`), playlists (`/playlist?list=`), hashtags (`/hashtag/…`) and search pages (`/results?search_query=…`, with the filters in the URL). Through the API, `startUrls` items are objects such as `{ "url": "https://www.youtube.com/@NASA" }`.

### Output example

Each result has a `dataType`: `video`, `comment` or `channel`. A value YouTube does not show is `null`. The dataset has four views: Videos, Comments, Channels and Subtitles.

A video from NASA's channel:

```json
{
  "dataType": "video",
  "id": "0E0S07VMSYI",
  "url": "https://www.youtube.com/watch?v=0E0S07VMSYI",
  "title": "Hubble: Vision, Hope and Triumph",
  "publishedAt": "2008-12-02T17:14:12.000Z",
  "durationSeconds": 276,
  "duration": "00:04:36",
  "viewCount": 13808,
  "likeCount": 79,
  "commentCount": 16,
  "commentsTurnedOff": false,
  "tags": ["nasa", "hubble", "space", "telescope", "science", "repair", "shuttle", "sts-125"],
  "hashtags": [],
  "category": "Science & Technology",
  "thumbnail": "https://i.ytimg.com/vi/0E0S07VMSYI/hqdefault.jpg",
  "videoType": "video",
  "isShort": false,
  "liveStatus": "none",
  "isMembersOnly": false,
  "isAgeRestricted": false,
  "hasPaidPromotion": false,
  "chapters": [],
  "subtitles": null,
  "channelId": "UCLA_DiR1FfKNvjuUpBHmylQ",
  "channelName": "NASA",
  "channelHandle": "@NASA",
  "channelUrl": "https://www.youtube.com/@NASA",
  "channelSubscriberCount": 15100000,
  "channelIsVerified": true,
  "sourceType": "channel",
  "sourceUrl": "https://www.youtube.com/@NASA",
  "position": 34,
  "scrapedAt": "2026-11-08T10:54:37.409Z"
}
```

With **Save subtitles** on, `subtitles` holds one entry per language:

```json
"subtitles": [
  {
    "language": "en",
    "languageName": "English",
    "isAutoGenerated": true,
    "format": "srt",
    "content": "1\n00:00:09,600 --> 00:00:11,360\nGood morning friends. Welcome back to\n\n2\n00:00:11,360 --> 00:00:13,520\nthe bakery..."
  }
]
```

A comment (a reply has the same fields, with `parentId` set):

```json
{
  "dataType": "comment",
  "id": "COMMENT_ID",
  "videoId": "VIDEO_ID",
  "videoTitle": "How to bake sourdough bread at home",
  "text": "Made this today and it came out perfect!",
  "author": "@viewer",
  "authorChannelUrl": "https://www.youtube.com/channel/AUTHOR_CHANNEL_ID",
  "likeCount": 4100,
  "replyCount": 93,
  "publishedAt": "2025-11-08T00:00:00.000Z",
  "publishedTimeText": "1 year ago",
  "isPinned": false,
  "hasCreatorHeart": true,
  "authorIsChannelOwner": false,
  "parentId": null
}
```

NASA's channel details:

```json
{
  "dataType": "channel",
  "id": "UCLA_DiR1FfKNvjuUpBHmylQ",
  "url": "https://www.youtube.com/@NASA",
  "name": "NASA",
  "handle": "@NASA",
  "description": "NASA's mission is to pioneer the future in space exploration, scientific discovery, and aeronautics research...",
  "subscriberCount": 15100000,
  "videoCount": 6201,
  "viewCount": 1134443909,
  "joinedAt": "2008-06-03",
  "country": null,
  "links": [{ "title": "nasa.gov", "url": "https://www.nasa.gov" }],
  "keywords": ["nasa", "space", "iss", "hubble", "apollo", "Artemis"],
  "isVerified": true
}
```

### Use cases

- **Market and competitor research**: what a channel or a topic publishes and how each video performs.
- **Influencer discovery**: find channels in a niche with their subscribers, country and contact links.
- **Trend research**: the most viewed videos for a term this week, or everything posted under a hashtag since a date.
- **Comment and sentiment analysis**: collect comments and replies for opinion mining, product feedback and community research.
- **YouTube SEO**: the titles, tags, descriptions, chapters and hashtags of the videos that rank for a term.
- **AI and LLM datasets**: subtitles and transcripts with video metadata, ready for training, summaries or retrieval (RAG).
- **Brand and content monitoring**: schedule a run every day with a date range to catch new videos and comments.

### Use YouTube Scraper via API, Python, JavaScript and integrations

Run it and get the results in one call with the [Apify API](https://docs.apify.com/api/v2):

```bash
curl -X POST "https://api.apify.com/v2/acts/socialscrapers~youtube-scraper/run-sync-get-dataset-items?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"searchQueries": ["sourdough bread recipe"], "maxResultsPerQuery": 50}'
```

Python, with the [Apify client](https://docs.apify.com/api/client/python):

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_API_TOKEN")
run = client.actor("socialscrapers/youtube-scraper").call(run_input={
    "startUrls": [{"url": "https://www.youtube.com/@NASA"}],
    "maxVideosPerChannel": 100,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["title"], item["viewCount"])
```

JavaScript, with the [Apify client](https://docs.apify.com/api/client/js):

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

const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });
const run = await client.actor('socialscrapers/youtube-scraper').call({ hashtags: ['sourdough'], maxResultsPerQuery: 100 });
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

You can also **schedule** runs, get a **webhook** when a run finishes, and connect the results to **Make, Zapier, n8n, Google Sheets, Slack** and other tools through [Apify integrations](https://docs.apify.com/integrations). AI agents and assistants can run YouTube Scraper through [Apify's MCP server](https://docs.apify.com/mcp).

### YouTube Data API vs YouTube Scraper

| | Official YouTube Data API | YouTube Scraper |
| --- | --- | --- |
| Setup | Google Cloud project and API key | None: give a search term, hashtag or URL |
| Limits | 10,000 quota units a day by default; one search costs 100 units | No quota: as many results as YouTube lists |
| Search | Keyword search with some filters | YouTube's search filters (type, upload date, duration, features, order), hashtags, date range |
| Subtitles | Only for videos you are allowed to edit | Any public video, in SRT, WebVTT, text or XML |
| Price | Free within the quota | From $0.40 per 1,000 videos |

### Limits

- **Public content only.** The scraper never signs in. Private and deleted videos are skipped and listed in the log. Comments of age-restricted videos need a signed-in account, so those videos are saved without comments.
- **YouTube lists a few hundred results per search term** (about 300 for a typical term), and the same goes for a hashtag's search. For more, add more terms, use filters, or split by date range. Channels and playlists are read in full.
- **Hashtag pages** show logged-out visitors only a few videos; the rest come from YouTube's search for the hashtag.
- **Search order** is relevance or popularity: YouTube no longer offers sorting search results by upload date or rating. Use the date range for recent videos.
- Subscriber counts and comment likes are as precise as YouTube shows them ("6.71M" becomes 6710000). Comment dates are estimated from YouTube's "2 weeks ago" text, to the day.
- Not included: dislike counts (not public), live chat, monetization status and video files.
- **Datacenter proxy choices fall back to residential.** If you pick Apify Proxy without the RESIDENTIAL group, the first session YouTube refuses moves the run to RESIDENTIAL, in the same country; custom proxy URLs are used exactly as given.
- **Share links work as they are**: `youtu.be/…` links, links with the app's `?si=…` share parameter, `m.youtube.com`, `music.youtube.com`, `/shorts/…`, `/live/…` and `/embed/…` links all name the same video, channel or playlist.
- **A run with 0 results still succeeds when your input was fine.** When a video is private or deleted, a channel does not exist or a search finds nothing, the run ends as Succeeded with a status message naming each input and why, and nothing is charged. A run fails only when no input is usable at all, or when YouTube refuses every one of 3 or more inputs.

### FAQ

**Is it legal to scrape YouTube?**
YouTube Scraper collects only data that anyone can see on YouTube without signing in. Comments and channel profiles can contain personal data, which laws such as the GDPR protect, so collect only what you need and have a legitimate reason for it. You are responsible for how you use the data and for following YouTube's terms and the laws that apply to you.

**Do I need a YouTube account, an API key or a quota?**
No. Give search terms, hashtags or URLs and start the run.

**How many results can I get?**
The scraper sets no upper limit. Channels and playlists are read in full if you ask for it; YouTube itself lists a few hundred results per search term.

**Why did I get fewer results than I asked for?**
YouTube had no more results for that search, hashtag, channel or date range, or the run reached its maximum cost. The run log says which, for each input.

**How do I get only new videos?**
Set **Published on or after** (for example `7 days`) and schedule the run daily or weekly. Channels in Latest order stop reading as soon as they pass the date.

**Can I download YouTube subtitles as SRT?**
Yes. Switch on **Save subtitles** and pick SRT, WebVTT, plain text or XML.

**Can I scrape YouTube Shorts?**
Yes: Shorts searches (result type Shorts), a channel's Shorts tab (Max Shorts per channel), a hashtag's Shorts, and Shorts URLs.

**Does it download the video files?**
No. YouTube Scraper collects data about videos, not the videos themselves.

**How fast is it?**
In test runs, 200 videos took under a minute, and 500 comments under half a minute.

### Other scrapers by Social Scrapers

| Scraper | What it gets |
| --- | --- |
| [YouTube Transcript Scraper](https://apify.com/socialscrapers/youtube-transcript-scraper) | Transcripts and subtitles of YouTube videos and channels |
| [Instagram Profile Scraper](https://apify.com/socialscrapers/instagram-profile-scraper) | Instagram profiles with their latest posts |
| [Instagram Post Scraper](https://apify.com/socialscrapers/instagram-post-scraper) | Instagram posts and reels with comments |
| [Facebook Groups Scraper](https://apify.com/socialscrapers/facebook-groups-scraper) | Posts from public Facebook groups |
| [Facebook Profile Scraper](https://apify.com/socialscrapers/facebook-profile-scraper) | Public Facebook profile and Page details |
| [Facebook Profile Posts Scraper](https://apify.com/socialscrapers/facebook-profile-posts-scraper) | Posts from Facebook profiles and Pages |
| [Facebook Ads Library Scraper](https://apify.com/socialscrapers/facebook-ads-library-scraper) | Ads from Meta's Ad Library |
| [X (Twitter) Profile Scraper](https://apify.com/socialscrapers/x-profile-scraper) | X (Twitter) profiles |
| [Threads Scraper](https://apify.com/socialscrapers/threads-scraper) | Threads profiles, posts and replies |
| [Reddit Scraper](https://apify.com/socialscrapers/reddit-scraper) | Reddit posts, comments, users and search |
| [Quora Scraper](https://apify.com/socialscrapers/quora-scraper) | Quora questions, answers and profiles |
| [LinkedIn Jobs Scraper](https://apify.com/socialscrapers/linkedin-jobs-scraper) | Job listings from LinkedIn |

# Actor input Schema

## `searchQueries` (type: `array`):

What you would type into YouTube's search box, one term per line. Example: <code>sourdough bread recipe</code>.

## `maxResultsPerQuery` (type: `integer`):

How many videos (or channels, for a channel search) to save for each search term, search URL and hashtag. No upper limit: YouTube keeps loading results for as long as it has them. Example: <code>500</code>.

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

What to search for. "Channels" saves one channel item per channel found instead of videos. For hashtags, "Shorts" reads the hashtag's Shorts.

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

Only videos uploaded within this period (YouTube's own search filter). For an exact range, use the date range below.

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

Only videos of this length.

## `features` (type: `array`):

Only videos with all of these features, as in YouTube's search filters. Example: <code>4K</code> and <code>Subtitles/CC</code>.

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

The order of the search results: YouTube's relevance, or most viewed first.

## `hashtags` (type: `array`):

Hashtags to collect videos for, with or without the #, one per line. Each hashtag gets up to the max results above, with the search filters applied. Example: <code>sourdough</code>.

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

Video, Shorts, channel (@handle, /channel/, /c/, /user/), channel tab (/videos, /shorts, /streams), playlist, hashtag (/hashtag/...) and search result URLs, each a full URL. Share links work as they are: youtu.be links and links with the app's ?si=… parameter. Example: <code>https://www.youtube.com/@NASA</code>.

## `maxVideosPerChannel` (type: `integer`):

How many videos to save from each channel's Videos tab, and from each playlist. 0 saves none (useful with channel details on, or to get only Shorts). No upper limit. Example: <code>200</code>.

## `maxShortsPerChannel` (type: `integer`):

How many Shorts to save from each channel's Shorts tab. 0 saves none. Example: <code>50</code>.

## `maxStreamsPerChannel` (type: `integer`):

How many live streams (current and past) to save from each channel's Live tab. 0 saves none. Example: <code>20</code>.

## `channelSortBy` (type: `string`):

Which of a channel's videos come first, as the sort buttons on the channel page: latest, most popular or oldest.

## `includeChannelInfo` (type: `boolean`):

Save one channel item per channel URL: subscribers, total videos and views, country, join date, description, links, avatar and banner.

## `publishedAfter` (type: `string`):

Only videos published on or after this date, or within this age. Pick a date or an age, or type one: a date (<code>2026-01-31</code>, <code>31/01/2026</code>, <code>Jan 31 2026</code>; a UTC day) or an age such as <code>7 days</code>, <code>2w</code>, <code>6 months</code> or <code>yesterday</code>. Applies to search terms, channels, playlists and hashtags; videos you give by URL are always saved.

## `publishedBefore` (type: `string`):

Only videos published on or before this date (the whole day counts), or before this age. A date (<code>2026-01-31</code>, <code>31/01/2026</code>, <code>Jan 31 2026</code>) or an age such as <code>7 days</code> or <code>1 year</code>.

## `includeComments` (type: `boolean`):

Save each video's comments as separate items, right after the video.

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

How many top-level comments to save for each video. No upper limit. Example: <code>1000</code>.

## `maxRepliesPerComment` (type: `integer`):

How many replies to save under each comment. 0 saves no replies. Example: <code>20</code>.

## `commentsSortBy` (type: `string`):

Top comments or newest first.

## `downloadSubtitles` (type: `boolean`):

Save each video's subtitles (captions) with the video, in the language and format below. Videos without subtitles get an empty list.

## `subtitlesLanguages` (type: `array`):

Language codes in order of preference, such as <code>en</code>, <code>es</code> or <code>pt-BR</code>. Each video gets the first of these it has (the creator's subtitles before automatic ones), else its main language. Leave empty for the main language.

## `subtitlesAllLanguages` (type: `boolean`):

Save every subtitle language a video has, instead of one.

## `subtitlesIncludeAutoGenerated` (type: `boolean`):

Use YouTube's automatic (speech recognition) subtitles when a video has no subtitles from its creator in your language.

## `subtitlesFormat` (type: `string`):

SRT and WebVTT keep the timing; plain text is the words only; XML is YouTube's own timed text.

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

Residential proxies give the most reliable results.

## `maxConcurrency` (type: `integer`):

How many videos are read at the same time. Example: <code>20</code>.

## Actor input object example

```json
{
  "searchQueries": [
    "sourdough bread recipe"
  ],
  "maxResultsPerQuery": 10,
  "searchType": "video",
  "uploadDate": "any",
  "duration": "any",
  "sortBy": "relevance",
  "maxVideosPerChannel": 10,
  "maxShortsPerChannel": 0,
  "maxStreamsPerChannel": 0,
  "channelSortBy": "newest",
  "includeChannelInfo": false,
  "includeComments": false,
  "maxCommentsPerVideo": 100,
  "maxRepliesPerComment": 0,
  "commentsSortBy": "top",
  "downloadSubtitles": false,
  "subtitlesLanguages": [
    "en"
  ],
  "subtitlesAllLanguages": false,
  "subtitlesIncludeAutoGenerated": true,
  "subtitlesFormat": "srt",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "maxConcurrency": 20
}
```

# 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 = {
    "searchQueries": [
        "sourdough bread recipe"
    ],
    "maxResultsPerQuery": 10,
    "maxVideosPerChannel": 10,
    "subtitlesLanguages": [
        "en"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("socialscrapers/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 = {
    "searchQueries": ["sourdough bread recipe"],
    "maxResultsPerQuery": 10,
    "maxVideosPerChannel": 10,
    "subtitlesLanguages": ["en"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("socialscrapers/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 '{
  "searchQueries": [
    "sourdough bread recipe"
  ],
  "maxResultsPerQuery": 10,
  "maxVideosPerChannel": 10,
  "subtitlesLanguages": [
    "en"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call socialscrapers/youtube-scraper --silent --output-dataset

```

## MCP server setup

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