# Youtube Scraper (`scrapier/youtube-scraper`) Actor

📺 YouTube Scraper extracts video & channel data — titles, descriptions, views, likes, comments, tags, publish dates & playlists. 🔍 Perfect for SEO research, content analysis, trend tracking & competitor insights. ⚡ Fast, reliable, API-ready. Also grabs thumbnails, durations, URLs, subtitles.

- **URL**: https://apify.com/scrapier/youtube-scraper.md
- **Developed by:** [Scrapier](https://apify.com/scrapier) (community)
- **Categories:** Videos, SEO tools, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.99 / 1,000 results

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

### Youtube Scraper

The Youtube Scraper is a fast, reliable YouTube data extraction tool that collects structured video and channel metadata directly from public search results and video pages — no API key required. It solves the heavy lifting of gathering titles, views, likes, comments count, durations, publish dates, hashtags, and transcripts at scale. Built for marketers, developers, data analysts, and researchers, this youtube video scraper and youtube data scraper supports advanced filters and automated transcript downloads to power SEO research, content analysis, and trend tracking workflows.

### What data / output can you get?

Below are common fields the actor stores to the Apify Dataset for each video. You can export results to JSON, CSV, or Excel via the Apify platform.

| Data type | Description | Example value |
| --- | --- | --- |
| title | Video title | “Inside the Apify platform” |
| type | Result type (“video” or “shorts”) | “video” |
| id | YouTube video ID | “dQw4w9WgXcQ” |
| url | Canonical video URL (Shorts use /shorts/) | “https://www.youtube.com/watch?v=dQw4w9WgXcQ” |
| thumbnailUrl | HD thumbnail URL | “https://i.ytimg.com/vi/dQw4w9WgXcQ/hq720.jpg” |
| viewCount | Parsed numeric view count | 1500000 |
| date | ISO-like publish date (when available) | “2025-01-15T00:00:00.000Z” |
| likes | Parsed like count (when available) | 50000 |
| duration | Normalized duration (HH:MM:SS) | “00:03:33” |
| channelName | Channel display name | “Apify” |
| channelId | Channel ID (UC…) when detected | “UCxxxxxxxxxxxxxxxxxxxxxxxx” |
| commentsCount | Parsed comments count (when available) | 12000 |

Bonus fields include:
- channelUrl, channelUsername
- numberOfSubscribers (when detected)
- text (description snippet or full description when available)
- descriptionLinks (array of { url, text })
- subtitles (available caption languages)
- hashtags (parsed from title/description)
- fromYTUrl (source results page URL or original video URL for direct scraping)
- isCreativeCommons, isPurchased (best-effort flags)
- transcript, transcriptLanguage, transcriptFormat (when transcript download is enabled)
- translatedTitle, translatedText, collaborators, isMonetized, commentsTurnedOff, order

### Key features

- ⚡️ Fast, concurrent enrichment
  Batch-fetches video pages and enriches results with likes, comments count, subscribers, subtitles, and more for high-throughput scraping.

- 🧠 No API key required
  Scrapes public YouTube web endpoints and watch pages directly, functioning as a dependable youtube scraper tool and youtube scraper API alternative.

- 🛡️ Smart anti-blocking with proxy escalation
  Automatically escalates from no proxy → Apify datacenter → Apify residential (with retries) and sticks with residential once it works.

- 🕵️ Browser impersonation for resilience
  Uses impit to mimic real Chrome/HTTP/TLS fingerprints and reduce blocking.

- 🎛️ Powerful filters
  Include-only videos matching HD, 4K, HDR, Live, 360°, 3D, VR180, CC, and location flags, plus date/type/length filters and post-run sorting.

- 💬 Transcript downloader
  Optional youtube transcript scraper: fetch subtitles/transcripts in SRT, plain text, or timestamped JSON.

- 🧩 Developer-friendly
  Built on Python and Apify SDK with structured outputs ready for pipelines (great for youtube scraper python integrations and automation).

- 🔌 Workflow-ready
  Results live in Apify Dataset for seamless export to JSON/CSV/Excel and integration with Make, n8n, Zapier, or internal systems.

- 🔒 Production-grade reliability
  Clear logging, connection strategy reporting, and pagination safety limits for hands-off operation.

### How to use Youtube Scraper - step by step

1. Create or log in to your Apify account.
2. Open the actor in Apify Console and click “Run”.
3. Enter input:
   - searchTerms: one or more keywords (e.g., “Crawlee”).
   - Or provide startUrls with direct video links.
4. Configure limits and filters:
   - maxVideos, maxShorts, maxStreams.
   - Add feature filters (isHD, is4K, isHDR, isLive, etc.).
   - Optionally set date/type/length filters and sorting.
5. (Optional) Enable transcript download:
   - downloadSubtitles, subtitlesLanguage, subtitlesFormat, preferAutoGenerated.
6. (Optional) Set proxyConfiguration:
   - Defaults to trying direct first, then falls back automatically.
7. Click Start:
   - Watch progress and proxy messages in the Log tab.
8. Review & export results:
   - Open the Dataset tab and export to JSON, CSV, or Excel.

Pro Tip: Orchestrate runs and pull datasets programmatically using the Apify API to build a fully automated youtube scraper API pipeline.

### Use cases

| Use case name | Description |
| --- | --- |
| Marketing + SEO research | Analyze titles, hashtags, and performance metrics to optimize your content strategy and keyword targeting. |
| Competitor monitoring | Track view counts, likes, and publish cadence across competitor videos and Shorts. |
| Content discovery | Find relevant long-form videos or Shorts via search terms and filter by HD/4K/HDR or length. |
| Academic & NLP workflows | Enable transcript download (SRT/text/JSON) to build datasets for topic modeling and language analysis. |
| Social listening lite | Monitor hashtags and commentsCount to gauge engagement on public videos without scraping private data. |
| Data pipeline integration | Feed structured outputs into BI dashboards or ETL workflows using the Apify API and CSV/JSON exports. |
| Editorial planning | Sort results by date or viewCount to spot trends and plan content calendars. |

### Why choose Youtube Scraper?

Positioned for precision and reliability, this YouTube metadata and transcript extractor combines performance with robust anti-blocking.

- ✅ Accurate enrichment: Combines search parsing with watch-page enrichment to add likes, commentsCount, subscribers, and subtitles when available.
- 🌍 Multilingual-ready: Targets subtitles and transcript languages across global content.
- 📈 Scalable by design: Concurrency controls and pagination safety handle batch runs smoothly.
- 💻 Developer access: Clean JSON schema and Apify API support make integration straightforward for youtube scraper python pipelines.
- 🛡️ Ethical & safe: Collects only publicly available data; no login or private access.
- 💸 Cost-effective automation: Export to JSON/CSV/Excel and automate with minimal setup.
- 🧩 Better than extensions: Avoids flaky browser extensions with a production-grade backend and transparent proxy strategy.

Bottom line: a dependable youtube scraper tool for teams that need structured, automation-ready outputs without brittle setups.

### Is it legal / ethical to use Youtube Scraper?

Yes — when done responsibly. This actor accesses only publicly available YouTube pages and does not log in or bypass authentication.

Guidelines to follow:
- Collect public video and channel metadata only.
- Avoid scraping private or paywalled content.
- Comply with applicable laws (e.g., GDPR, CCPA) and respect YouTube terms.
- Use the data responsibly and verify compliance with your legal team for edge cases.

### Input parameters & output format

Example JSON input
```json
{
  "searchTerms": ["Crawlee"],
  "maxVideos": 10,
  "maxShorts": 0,
  "maxStreams": 0,
  "downloadSubtitles": true,
  "saveSubtitlesToKvs": false,
  "subtitlesLanguage": "en",
  "preferAutoGenerated": false,
  "subtitlesFormat": "srt",
  "sortingOrder": "date",
  "dateFilter": "week",
  "videoTypeFilter": "video",
  "lengthFilter": "medium",
  "isHD": true,
  "hasCC": false,
  "isCreativeCommons": false,
  "is3D": false,
  "isLive": false,
  "isPurchased": false,
  "is4K": false,
  "is360": false,
  "hasLocation": false,
  "isHDR": false,
  "isVR180": false,
  "publishedAfter": "",
  "sortBy": "viewCount",
  "proxyConfiguration": { "useApifyProxy": false }
}
````

All input fields

- searchTerms (array)
  - Description: Enter one or more YouTube search keywords. The actor runs a full scrape per term and collects matching videos, Shorts, and streams.
  - Default: not set
  - Required: no

- maxVideos (integer)
  - Description: How many regular (non‑Shorts, non‑live) videos to scrape per search term. Use 0 to skip long‑form videos.
  - Default: 10
  - Required: no

- maxShorts (integer)
  - Description: How many YouTube Shorts to collect per keyword. Use 0 to exclude Shorts.
  - Default: 0
  - Required: no

- maxStreams (integer)
  - Description: Limit how many live or upcoming streams to scrape per search term. Use 0 to ignore live content.
  - Default: 0
  - Required: no

- startUrls (array)
  - Description: Provide direct YouTube URLs to scrape without using search terms. (Current implementation processes direct video URLs.)
  - Default: not set
  - Required: no

- downloadSubtitles (boolean)
  - Description: Download video subtitles/transcripts when available.
  - Default: false
  - Required: no

- saveSubtitlesToKvs (boolean)
  - Description: Store each downloaded transcript in the key‑value store (e.g., “transcript-VIDEO\_ID”) for separate download.
  - Default: false
  - Required: no

- subtitlesLanguage (string)
  - Description: Primary language for subtitles/transcripts (e.g., en, es, fr, de).
  - Default: "en"
  - Required: no

- preferAutoGenerated (boolean)
  - Description: Prefer auto‑generated subtitles over manually uploaded ones.
  - Default: false
  - Required: no

- subtitlesFormat (string) — one of: "srt", "text", "timestamp"
  - Description: Output format for transcripts (SRT, plain text, or timestamped JSON).
  - Default: "srt"
  - Required: no

- sortingOrder (string) — one of: "", "relevance", "date", "viewCount", "rating"
  - Description: Sort order applied via the YouTube search URL; post-run sorting also supported.
  - Default: ""
  - Required: no

- dateFilter (string) — one of: "", "hour", "today", "week", "month", "year"
  - Description: Apply YouTube’s “Upload date” filter.
  - Default: ""
  - Required: no

- videoTypeFilter (string) — one of: "", "video", "channel", "playlist", "movie"
  - Description: Keep only standard videos (exclude Shorts) when set to "video".
  - Default: ""
  - Required: no

- lengthFilter (string) — one of: "", "short", "medium", "long"
  - Description: Use YouTube’s length presets (under 4 mins, 4–20 mins, over 20 mins).
  - Default: ""
  - Required: no

- isHD (boolean)
  - Description: Only include HD videos (720p+).
  - Default: false
  - Required: no

- hasCC (boolean)
  - Description: Only include videos with at least one proper CC track.
  - Default: false
  - Required: no

- isCreativeCommons (boolean)
  - Description: Keep only videos marked Creative Commons when available.
  - Default: false
  - Required: no

- is3D (boolean)
  - Description: Include only stereoscopic 3D videos.
  - Default: false
  - Required: no

- isLive (boolean)
  - Description: Restrict results to live/live‑style content.
  - Default: false
  - Required: no

- isPurchased (boolean)
  - Description: Best‑effort filter for purchased/paid content.
  - Default: false
  - Required: no

- is4K (boolean)
  - Description: Keep only videos that offer at least one 2160p stream.
  - Default: false
  - Required: no

- is360 (boolean)
  - Description: Include only 360° (spherical) videos.
  - Default: false
  - Required: no

- hasLocation (boolean)
  - Description: Include only videos with explicit location metadata.
  - Default: false
  - Required: no

- isHDR (boolean)
  - Description: Include only High Dynamic Range videos.
  - Default: false
  - Required: no

- isVR180 (boolean)
  - Description: Include only VR180 videos.
  - Default: false
  - Required: no

- publishedAfter (string; YYYY-MM-DD or empty)
  - Description: Include only videos published after this date.
  - Default: ""
  - Required: no

- sortBy (string) — one of: "", "date", "viewCount", "likes"
  - Description: Post‑processing sort of the final dataset by a chosen field.
  - Default: ""
  - Required: no

- proxyConfiguration (object)
  - Description: Choose starting proxy setup. Actor auto‑escalates from none → datacenter → residential if blocked.
  - Default: { "useApifyProxy": false } (prefill)
  - Required: no

Example JSON output

```json
{
  "title": "Video Title",
  "translatedTitle": null,
  "type": "video",
  "id": "dQw4w9WgXcQ",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "thumbnailUrl": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hq720.jpg",
  "viewCount": 1500000,
  "date": "2025-01-15T00:00:00.000Z",
  "likes": 50000,
  "location": null,
  "channelName": "Channel Name",
  "channelUrl": "https://www.youtube.com/@channelname",
  "channelUsername": "channelname",
  "collaborators": null,
  "channelId": "UCxxxxxxxxxxxxxxxxxxxxxxxx",
  "numberOfSubscribers": 1000000,
  "duration": "00:03:33",
  "commentsCount": 12000,
  "text": "Video description...",
  "translatedText": null,
  "descriptionLinks": [
    { "url": "https://example.com", "text": "https://example.com" }
  ],
  "subtitles": ["en", "es"],
  "order": 0,
  "commentsTurnedOff": false,
  "fromYTUrl": "https://www.youtube.com/results?search_query=example",
  "isMonetized": null,
  "hashtags": ["#example"],
  "isCreativeCommons": false,
  "isPurchased": false,
  "transcript": "1\n00:00:00,000 --> 00:00:02,000\nHello world...\n",
  "transcriptLanguage": "en",
  "transcriptFormat": "srt"
}
```

Notes:

- Some fields (likes, commentsCount, numberOfSubscribers, subtitles, transcript) appear only when detected.
- If neither searchTerms nor startUrls are set, the actor uses “Crawlee” as a default search term.

### FAQ

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

No. The actor fetches public web data from YouTube’s endpoints and watch pages, so you can run it without any API key.

#### Can this scrape YouTube comments?

It captures commentsCount from public pages when available, but it does not extract individual comment texts. For most analytics, commentsCount is a useful engagement metric to combine with views and likes.

#### Does it download transcripts/subtitles?

Yes. Enable downloadSubtitles and choose subtitlesLanguage and subtitlesFormat (srt, text, or timestamp). You can also prefer auto-generated tracks.

#### Can I target only long-form videos or filter by length/quality?

Yes. Use videoTypeFilter="video" to focus on standard videos and lengthFilter to keep short/medium/long durations. Quality-based filters like isHD, is4K, and isHDR are also supported.

#### Can I use it with Python or via an API?

Yes. It runs on Apify and integrates via the Apify API. This makes it easy to embed in a youtube scraper python pipeline or use it as a youtube scraper API in your workflows.

#### What happens if requests get blocked?

The actor automatically escalates connection type: no proxy → Apify datacenter → Apify residential (with retries) and continues with residential once successful.

#### Does it support direct URLs?

Yes, for direct video URLs. The current implementation processes search results and individual video pages when provided in startUrls.

#### How many videos can I scrape per query?

You control this with maxVideos and maxShorts. The actor paginates and stops as soon as your limits are reached or pages are exhausted.

### Closing CTA / Final thoughts

The Youtube Scraper is built for structured, scalable YouTube metadata and transcript extraction from public pages. With smart filtering, robust anti-blocking, and developer-friendly outputs, it helps marketers, analysts, and researchers build repeatable youtube data extraction tool workflows. Use it via the Apify API to automate a youtube scraper API pipeline or connect exports to your BI stack. Start extracting smarter, transcript-enabled YouTube insights today.

### What are other Youtube scraping tools?

If you want to scrape specific Youtube data, you can use any of the dedicated scrapers below for faster and more targeted results.

| Scraper Name | Scraper Name |
|---|---|
| [Youtube B2b Email Scraper](https://apify.com/scrapier/youtube-b2b-email-scraper) | [YouTube Most Replayed Scraper](https://apify.com/scrapier/youtube-most-replayed-actor) |
| [Youtube B2b Lead Scraper](https://apify.com/scrapier/youtube-b2b-lead-scraper) | [Youtube Phone Number Scraper](https://apify.com/scrapier/youtube-phone-number-scraper) |
| [Youtube B2b Phone Number Scraper](https://apify.com/scrapier/youtube-b2b-phone-number-scraper) | [YouTube Playlist Extractor](https://apify.com/scrapier/youtube-playlist-scraper) |
| [Youtube Channel Email Scraper](https://apify.com/scrapier/youtube-channel-email-scraper) | [Youtube Search And Channel Scraper](https://apify.com/scrapier/youtube-search-and-channel-scraper) |
| [Youtube Channel Finder](https://apify.com/scrapier/youtube-channel-finder) | [Youtube Search Scraper](https://apify.com/scrapier/youtube-search-scraper) |
| [Youtube Channel Lead Scraper](https://apify.com/scrapier/youtube-channel-lead-scraper) | [YouTube Shorts Scraper](https://apify.com/scrapier/youtube-shorts-scraper) |
| [Youtube Channel Phone Number Scraper](https://apify.com/scrapier/youtube-channel-phone-number-scraper) | [Youtube Transcript Scraper](https://apify.com/scrapier/youtube-transcript-scraper) |
| [Youtube Channel Scraper](https://apify.com/scrapier/youtube-channel-scraper) | [YouTube Trending Scraper](https://apify.com/scrapier/youtube-trending-scraper) |
| [YouTube Comments Scraper](https://apify.com/scrapier/youtube-comments-scraper) | [YouTube Video Details Scraper](https://apify.com/scrapier/youtube-video-details-scraper) |
| [Youtube Community Posts Scraper](https://apify.com/scrapier/youtube-community-posts-scraper) | [YouTube Video Scraper By Hashtag](https://apify.com/scrapier/youtube-video-scraper-by-hashtag) |
| [Youtube Email Scraper](https://apify.com/scrapier/youtube-email-scraper) | [YouTube Video Subtitles Scraper](https://apify.com/scrapier/youtube-video-subtitles-scraper) |
| [Youtube Lead Scraper](https://apify.com/scrapier/youtube-lead-scraper) | [YouTube Video Summarizer](https://apify.com/scrapier/youtube-video-summarizer) |
| [YouTube Metadata Scraper](https://apify.com/scrapier/youtube-metadata-scraper) |  |

# Actor input Schema

## `searchTerms` (type: `array`):

Enter one or more YouTube search keywords (for example "Crawlee", "fitness workout"). The actor will run a full scrape for each term and collect matching videos, shorts, and streams.

💬 For custom solutions or feature requests, contact us at dev.scraperengine@gmail.com

## `maxVideos` (type: `integer`):

Set how many regular (non‑Shorts, non‑live) videos to scrape for each search term. Use 0 to skip long‑form videos completely and focus only on Shorts or streams.

## `maxShorts` (type: `integer`):

Control how many YouTube Shorts (vertical clips) to collect per keyword. Use 0 if you do not want to include Shorts in your dataset.

## `maxStreams` (type: `integer`):

Limit how many live or upcoming streams are scraped for each search term. Use 0 to ignore live content entirely.

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

Provide direct YouTube video, channel, playlist, or results page URLs to scrape without using search terms. This is ideal for monitoring specific assets.

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

Download video subtitles/transcripts when available. When enabled, the actor will try to fetch caption tracks and optionally full transcripts for each scraped video.

## `saveSubtitlesToKvs` (type: `boolean`):

When enabled, every downloaded transcript is stored in the default Apify key‑value store under its own key (e.g. "transcript-VIDEO\_ID") so you can download large subtitle files separately from the main dataset.

## `subtitlesLanguage` (type: `string`):

Choose the primary language for subtitles/transcripts (e.g. en, es, fr, de). The actor will look for this language first and fall back to available tracks where possible.

## `preferAutoGenerated` (type: `boolean`):

If turned on, the actor will prefer auto‑generated subtitles over manually uploaded caption tracks. This can increase coverage for less localized videos at the cost of some accuracy.

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

Decide how transcripts should look in the output: classic SRT (with timestamps), simple plain text, or structured timestamped JSON that is easy to post‑process programmatically.

## `sortingOrder` (type: `string`):

Sort the final dataset by relevance (original order), upload date, view count, or rating. Applied as post-processing for reliable results.

## `dateFilter` (type: `string`):

Apply YouTube’s built‑in "Upload date" filter: last hour, today, this week, this month, or this year — just like clicking the filter in the YouTube interface.

## `videoTypeFilter` (type: `string`):

Filter to only standard videos (exclude Shorts). Select 'video' to keep only long-form videos. Channel/playlist/movie apply when supported.

## `lengthFilter` (type: `string`):

Use YouTube’s length presets to keep only short clips, medium‑length videos, or long‑form content over 20 minutes.

## `isHD` (type: `boolean`):

Only include HD videos (720p or higher). The actor inspects YouTube's streaming formats to verify resolution before including the video.

## `hasCC` (type: `boolean`):

Only include videos that have at least one proper closed‑caption track (not just auto‑generated). Great for accessibility‑critical workflows.

## `isCreativeCommons` (type: `boolean`):

Filter for videos marked by YouTube as Creative Commons licensed. This can help discover content that is more remix‑friendly (always check final license conditions yourself).

## `is3D` (type: `boolean`):

Keep only stereoscopic 3D videos that YouTube flags as special 3D content.

## `isLive` (type: `boolean`):

Restrict results to live or live‑style content. Combine this with maxStreams to build focused dashboards of live events or streams.

## `isPurchased` (type: `boolean`):

Best-effort filter for purchased/paid content. YouTube rarely exposes this in scraped data, so results may be limited. Use for niche use cases only.

## `is4K` (type: `boolean`):

Keep only videos that offer at least one 2160p (4K) stream in their available formats.

## `is360` (type: `boolean`):

Filter results down to immersive 360° videos (spherical / equirectangular projection) that can be explored in all directions.

## `hasLocation` (type: `boolean`):

Only keep videos where YouTube exposes explicit location metadata in the player response (for example city/country information).

## `isHDR` (type: `boolean`):

Limit the dataset to High Dynamic Range (HDR) videos, detected from color information and HDR‑specific flags in the available formats.

## `isVR180` (type: `boolean`):

Filter for VR180 immersive content suitable for VR headsets when YouTube marks the video as VR180.

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

Only include videos published after this date. Pick a date in the calendar (absolute format YYYY-MM-DD). Leave empty to include all dates.

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

After scraping, optionally sort the final dataset by a chosen field (date, viewCount, or likes) so that the default dataset view is ordered exactly how you like it.

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

Select the starting proxy setup for this actor. By default it uses no proxy and, if YouTube blocks the traffic, the actor automatically escalates to Apify datacenter proxy and then to residential proxy with up to 3 retries, locking onto residential for the rest of the run.

## Actor input object example

```json
{
  "searchTerms": [
    "Crawlee"
  ],
  "maxVideos": 10,
  "maxShorts": 0,
  "maxStreams": 0,
  "startUrls": [],
  "downloadSubtitles": false,
  "saveSubtitlesToKvs": false,
  "subtitlesLanguage": "en",
  "preferAutoGenerated": false,
  "subtitlesFormat": "srt",
  "sortingOrder": "",
  "dateFilter": "",
  "videoTypeFilter": "",
  "lengthFilter": "",
  "isHD": false,
  "hasCC": false,
  "isCreativeCommons": false,
  "is3D": false,
  "isLive": false,
  "isPurchased": false,
  "is4K": false,
  "is360": false,
  "hasLocation": false,
  "isHDR": false,
  "isVR180": false,
  "publishedAfter": "",
  "sortBy": "",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# 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 = {
    "searchTerms": [
        "Crawlee"
    ],
    "startUrls": [],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapier/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 = {
    "searchTerms": ["Crawlee"],
    "startUrls": [],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("scrapier/youtube-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchTerms": [
    "Crawlee"
  ],
  "startUrls": [],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call scrapier/youtube-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=scrapier/youtube-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Youtube Scraper",
        "description": "📺 YouTube Scraper extracts video & channel data — titles, descriptions, views, likes, comments, tags, publish dates & playlists. 🔍 Perfect for SEO research, content analysis, trend tracking & competitor insights. ⚡ Fast, reliable, API-ready. Also grabs thumbnails, durations, URLs, subtitles.",
        "version": "0.1",
        "x-build-id": "RGSOF8EVmWySlIhMc"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/scrapier~youtube-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-scrapier-youtube-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/scrapier~youtube-scraper/runs": {
            "post": {
                "operationId": "runs-sync-scrapier-youtube-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/scrapier~youtube-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-scrapier-youtube-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "searchTerms": {
                        "title": "🔍 Search terms",
                        "type": "array",
                        "description": "Enter one or more YouTube search keywords (for example \"Crawlee\", \"fitness workout\"). The actor will run a full scrape for each term and collect matching videos, shorts, and streams.\n\n💬 For custom solutions or feature requests, contact us at dev.scraperengine@gmail.com",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxVideos": {
                        "title": "🎞️ Maximum videos per search term",
                        "minimum": 0,
                        "maximum": 9999,
                        "type": "integer",
                        "description": "Set how many regular (non‑Shorts, non‑live) videos to scrape for each search term. Use 0 to skip long‑form videos completely and focus only on Shorts or streams.",
                        "default": 10
                    },
                    "maxShorts": {
                        "title": "📱 Maximum Shorts per search term",
                        "minimum": 0,
                        "maximum": 9999,
                        "type": "integer",
                        "description": "Control how many YouTube Shorts (vertical clips) to collect per keyword. Use 0 if you do not want to include Shorts in your dataset.",
                        "default": 0
                    },
                    "maxStreams": {
                        "title": "📡 Maximum streams per search term",
                        "minimum": 0,
                        "maximum": 9999,
                        "type": "integer",
                        "description": "Limit how many live or upcoming streams are scraped for each search term. Use 0 to ignore live content entirely.",
                        "default": 0
                    },
                    "startUrls": {
                        "title": "🔗 Direct URLs",
                        "type": "array",
                        "description": "Provide direct YouTube video, channel, playlist, or results page URLs to scrape without using search terms. This is ideal for monitoring specific assets.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "downloadSubtitles": {
                        "title": "💬 Download subtitles",
                        "type": "boolean",
                        "description": "Download video subtitles/transcripts when available. When enabled, the actor will try to fetch caption tracks and optionally full transcripts for each scraped video.",
                        "default": false
                    },
                    "saveSubtitlesToKvs": {
                        "title": "🗄️ Save subtitles to key‑value store",
                        "type": "boolean",
                        "description": "When enabled, every downloaded transcript is stored in the default Apify key‑value store under its own key (e.g. \"transcript-VIDEO_ID\") so you can download large subtitle files separately from the main dataset.",
                        "default": false
                    },
                    "subtitlesLanguage": {
                        "title": "🌐 Subtitle language",
                        "enum": [
                            "en",
                            "es",
                            "fr",
                            "de",
                            "pt",
                            "it",
                            "ru",
                            "ja",
                            "ko",
                            "zh",
                            "ar",
                            "hi",
                            "bn",
                            "tr",
                            "pl",
                            "nl",
                            "sv",
                            "id",
                            "th",
                            "vi"
                        ],
                        "type": "string",
                        "description": "Choose the primary language for subtitles/transcripts (e.g. en, es, fr, de). The actor will look for this language first and fall back to available tracks where possible.",
                        "default": "en"
                    },
                    "preferAutoGenerated": {
                        "title": "⚙️ Prefer automatically generated subtitles",
                        "type": "boolean",
                        "description": "If turned on, the actor will prefer auto‑generated subtitles over manually uploaded caption tracks. This can increase coverage for less localized videos at the cost of some accuracy.",
                        "default": false
                    },
                    "subtitlesFormat": {
                        "title": "📄 Subtitle format",
                        "enum": [
                            "srt",
                            "text",
                            "timestamp"
                        ],
                        "type": "string",
                        "description": "Decide how transcripts should look in the output: classic SRT (with timestamps), simple plain text, or structured timestamped JSON that is easy to post‑process programmatically.",
                        "default": "srt"
                    },
                    "sortingOrder": {
                        "title": "🧮 Sorting order",
                        "enum": [
                            "",
                            "relevance",
                            "date",
                            "viewCount",
                            "rating"
                        ],
                        "type": "string",
                        "description": "Sort the final dataset by relevance (original order), upload date, view count, or rating. Applied as post-processing for reliable results.",
                        "default": ""
                    },
                    "dateFilter": {
                        "title": "🕒 Date filter",
                        "enum": [
                            "",
                            "hour",
                            "today",
                            "week",
                            "month",
                            "year"
                        ],
                        "type": "string",
                        "description": "Apply YouTube’s built‑in \"Upload date\" filter: last hour, today, this week, this month, or this year — just like clicking the filter in the YouTube interface.",
                        "default": ""
                    },
                    "videoTypeFilter": {
                        "title": "📂 Video type filter",
                        "enum": [
                            "",
                            "video",
                            "channel",
                            "playlist",
                            "movie"
                        ],
                        "type": "string",
                        "description": "Filter to only standard videos (exclude Shorts). Select 'video' to keep only long-form videos. Channel/playlist/movie apply when supported.",
                        "default": ""
                    },
                    "lengthFilter": {
                        "title": "⏱️ Length filter",
                        "enum": [
                            "",
                            "short",
                            "medium",
                            "long"
                        ],
                        "type": "string",
                        "description": "Use YouTube’s length presets to keep only short clips, medium‑length videos, or long‑form content over 20 minutes.",
                        "default": ""
                    },
                    "isHD": {
                        "title": "📺 HD",
                        "type": "boolean",
                        "description": "Only include HD videos (720p or higher). The actor inspects YouTube's streaming formats to verify resolution before including the video.",
                        "default": false
                    },
                    "hasCC": {
                        "title": "📝 Subtitles / CC",
                        "type": "boolean",
                        "description": "Only include videos that have at least one proper closed‑caption track (not just auto‑generated). Great for accessibility‑critical workflows.",
                        "default": false
                    },
                    "isCreativeCommons": {
                        "title": "⚖️ Creative Commons",
                        "type": "boolean",
                        "description": "Filter for videos marked by YouTube as Creative Commons licensed. This can help discover content that is more remix‑friendly (always check final license conditions yourself).",
                        "default": false
                    },
                    "is3D": {
                        "title": "🕶️ 3D",
                        "type": "boolean",
                        "description": "Keep only stereoscopic 3D videos that YouTube flags as special 3D content.",
                        "default": false
                    },
                    "isLive": {
                        "title": "📺 Live only",
                        "type": "boolean",
                        "description": "Restrict results to live or live‑style content. Combine this with maxStreams to build focused dashboards of live events or streams.",
                        "default": false
                    },
                    "isPurchased": {
                        "title": "💳 Purchased content",
                        "type": "boolean",
                        "description": "Best-effort filter for purchased/paid content. YouTube rarely exposes this in scraped data, so results may be limited. Use for niche use cases only.",
                        "default": false
                    },
                    "is4K": {
                        "title": "🖥️ 4K only",
                        "type": "boolean",
                        "description": "Keep only videos that offer at least one 2160p (4K) stream in their available formats.",
                        "default": false
                    },
                    "is360": {
                        "title": "🌐 360° video",
                        "type": "boolean",
                        "description": "Filter results down to immersive 360° videos (spherical / equirectangular projection) that can be explored in all directions.",
                        "default": false
                    },
                    "hasLocation": {
                        "title": "📍 With location",
                        "type": "boolean",
                        "description": "Only keep videos where YouTube exposes explicit location metadata in the player response (for example city/country information).",
                        "default": false
                    },
                    "isHDR": {
                        "title": "🌈 HDR only",
                        "type": "boolean",
                        "description": "Limit the dataset to High Dynamic Range (HDR) videos, detected from color information and HDR‑specific flags in the available formats.",
                        "default": false
                    },
                    "isVR180": {
                        "title": "🥽 VR180 only",
                        "type": "boolean",
                        "description": "Filter for VR180 immersive content suitable for VR headsets when YouTube marks the video as VR180.",
                        "default": false
                    },
                    "publishedAfter": {
                        "title": "📆 Scrape videos published after (date)",
                        "pattern": "^(\\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$|^$",
                        "type": "string",
                        "description": "Only include videos published after this date. Pick a date in the calendar (absolute format YYYY-MM-DD). Leave empty to include all dates.",
                        "default": ""
                    },
                    "sortBy": {
                        "title": "📊 Sort by (post‑processing)",
                        "enum": [
                            "",
                            "date",
                            "viewCount",
                            "likes"
                        ],
                        "type": "string",
                        "description": "After scraping, optionally sort the final dataset by a chosen field (date, viewCount, or likes) so that the default dataset view is ordered exactly how you like it.",
                        "default": ""
                    },
                    "proxyConfiguration": {
                        "title": "🛡️ Proxy configuration & anti‑blocking",
                        "type": "object",
                        "description": "Select the starting proxy setup for this actor. By default it uses no proxy and, if YouTube blocks the traffic, the actor automatically escalates to Apify datacenter proxy and then to residential proxy with up to 3 retries, locking onto residential for the rest of the run."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
