# YouTube Scraper - Cheapest Pay-Per-Result (`prince.sh/youtube-scraper`) Actor

Scrape YouTube search results, videos, channels, playlists, subtitles and AI transcripts. Same data as the leading YouTube scrapers, priced lower per result.

- **URL**: https://apify.com/prince.sh/youtube-scraper.md
- **Developed by:** [Prince Jain](https://apify.com/prince.sh) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.70 / 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

Scrape YouTube search results, videos, channels, playlists, subtitles and AI transcripts. Pay-per-result pricing set below the big scrapers, same fields.

### What it does

- **Search terms**: type keywords like you would in the YouTube search bar. Get videos, shorts and streams back with view counts, dates, channels.
- **Direct URLs**: paste a video, channel, playlist, or a `/results?search_query=` link.
- **Full video details**: title, description, view count, likes, comments count, subscriber count, duration, thumbnails, upload date.
- **Channel info**: description, links, subscriber count, total views, total videos, country, join date. Every video item carries the channel fields.
- **Subtitles**: download YouTube's own subtitles or auto-generated ones, in SRT, WebVTT, XML or plain text.
- **AI transcript**: videos without subtitles get transcribed by Whisper. The transcript lands in the key-value store, linked from each item via `transcriptionUrl`.
- **AI summary and description**: optional add-ons that write a short summary and a time-segmented description into the item.
- **Filters**: sort by relevance, rating, upload date or views. Filter by upload date (hour, day, week, month, year), type, length, and features like HD, 4K, live, subtitles/CC.
- **Channel date range**: only keep videos published after a date, absolute (`2025-01-01`) or relative (`3 days`).

### Input

Either paste direct URLs or type search terms.

```json
{
    "searchQueries": ["web scraping tutorials"],
    "maxResults": 20,
    "maxResultsShorts": 10,
    "maxResultStreams": 0,
    "transcriptionAndSubtitle": "ALWAYS_SUBTITLES",
    "subtitlesLanguage": "en",
    "subtitlesFormat": "srt",
    "sortingOrder": "views",
    "dateFilter": "month"
}
```

```json
{
    "startUrls": [
        { "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" },
        { "url": "https://www.youtube.com/@LofiGirl" },
        { "url": "https://www.youtube.com/playlist?list=PL6i60qoDQhQGaGbbg-4aSwXJvxOqO6o5e" }
    ],
    "maxResults": 50
}
```

`maxResults`, `maxResultsShorts`, `maxResultStreams` cap how many of each type come back **per search term or per channel/playlist**. Set a type to 0 to skip it. Direct video URLs are always scraped.

### Output

Each item:

```json
{
    "id": "CW7gfrTlr0Y",
    "title": "Stromae - Santé (Live)",
    "url": "https://www.youtube.com/watch?v=CW7gfrTlr0Y",
    "thumbnailUrl": "https://i.ytimg.com/vi/CW7gfrTlr0Y/maxresdefault.jpg",
    "viewCount": 35582192,
    "date": "2021-12-21",
    "likes": 512238,
    "channelName": "StromaeVEVO",
    "channelUrl": "https://www.youtube.com/channel/...",
    "numberOfSubscribers": 6930000,
    "duration": "00:03:17",
    "commentsCount": 14,
    "text": "...description...",
    "subtitles": [{ "type": "auto_generated", "language": "en", "srt": "1\n00:00:00,320 --> ..." }],
    "transcriptionUrl": "https://api.apify.com/v2/key-value-stores/.../records/transcription-...",
    "aiVideoSummary": "...",
    "aiVideoDescription": [{ "startSecond": 0, "endSecond": 81, "displayTime": "00:00:00 - 00:01:21", "description": "..." }],
    "fromYTUrl": "https://www.youtube.com/results?search_query=..."
}
```

Failed inputs produce an error item instead of being dropped:

```json
{ "url": "https://www.youtube.com/@badchannel", "input": "@badchannel", "error": "CHANNEL_DOES_NOT_EXIST", "note": "Channel does not exist" }
```

### Pricing

You only pay for results stored. No monthly fee, no minimum spend. Transcription and AI add-ons are optional and charged per use.

### Notes

- No login, no cookies needed. Runs on YouTube's own internal API plus a hardened audio pipeline for transcripts.
- Subtitles download goes through yt-dlp under the hood, so it stays working when YouTube changes their caption endpoints.

# Actor input Schema

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

Enter search terms just like you would in YouTube's search bar.

## `maxResults` (type: `integer`):

Limit the number of regular videos to scrape. For channels, acts as the limit for regular videos.

## `maxResultsShorts` (type: `integer`):

Limit the number of Shorts videos to scrape.

## `maxResultStreams` (type: `integer`):

Limit the number of live/upcoming stream videos to scrape.

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

Link to a YouTube video, channel, playlist or search results page. You can also import a CSV or Google Sheet with URLs. <b>Note:</b> search terms are ignored when direct URLs are used.

## `transcriptionAndSubtitle` (type: `string`):

Download existing subtitles, generate an AI transcript for videos that lack them, or always transcribe. Subtitles land on dataset items; transcripts are stored in the key-value store.

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

Language to download subtitles in. Only used when a subtitle option is selected above.

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

Format for downloaded subtitles

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

YouTube sorting parameter for search

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

YouTube upload date filter for search

## `videoType` (type: `string`):

YouTube video type filter for search

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

YouTube video length filter for search

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

Apply the HD filter for search

## `hasSubtitles` (type: `boolean`):

Apply the Subtitles/CC filter for search

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

Apply the Creative Commons filter for search

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

Apply the 3D filter for search

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

Apply the Live filter for search

## `isBought` (type: `boolean`):

Apply the Purchased filter for search

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

Apply the 4K filter for search

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

Apply the 360 degrees filter for search

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

Apply the Location filter for search

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

Apply the HDR filter for search

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

Apply the VR180 filter for search

## `gl` (type: `string`):

YouTube country parameter (e.g. US, IN, DE). Affects which localized results and trends YouTube returns.

## `hl` (type: `string`):

YouTube interface language parameter (e.g. en, hi, de). Affects localized UI text and relative dates.

## `oldestPostDate` (type: `string`):

Only posts uploaded after this date get scraped. Relative values like <code>2 days</code> also work. Applies to channel URL scraping; sorting resets to NEWEST.

## `sortVideosBy` (type: `string`):

Maps to the sorting buttons on the channel's Videos, Shorts and Live pages.

## `aiVideoDescription` (type: `boolean`):

AI-generated time-segmented description of the video, based on its transcript and metadata.

## `aiVideoSummary` (type: `boolean`):

AI-generated concise summary of the video based on its transcript and metadata.

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

YouTube rate-limits datacenter IPs. Residential proxies are recommended for large runs.

## `saveSubsToKVS` (type: `boolean`):

If true, downloaded subtitles are also saved to the key-value store. Transcripts are always saved there.

## `preferAutoGeneratedSubtitles` (type: `boolean`):

If true, auto-generated subtitles are preferred over uploaded ones. A subtitle option and language must be selected.

## Actor input object example

```json
{
  "searchQueries": [
    "web scraping tutorials"
  ],
  "maxResults": 10,
  "maxResultsShorts": 5,
  "maxResultStreams": 0,
  "startUrls": [
    {
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    }
  ],
  "transcriptionAndSubtitle": "NONE",
  "subtitlesLanguage": "en",
  "subtitlesFormat": "srt",
  "sortingOrder": "relevance",
  "dateFilter": "month",
  "videoType": "video",
  "lengthFilter": "between420",
  "gl": "US",
  "hl": "en",
  "oldestPostDate": "2024-01-01",
  "sortVideosBy": "NEWEST",
  "aiVideoDescription": false,
  "aiVideoSummary": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing scraped YouTube video information

# 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": [
        "Crawlee"
    ],
    "maxResults": 10,
    "maxResultsShorts": 0,
    "maxResultStreams": 0
};

// Run the Actor and wait for it to finish
const run = await client.actor("prince.sh/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": ["Crawlee"],
    "maxResults": 10,
    "maxResultsShorts": 0,
    "maxResultStreams": 0,
}

# Run the Actor and wait for it to finish
run = client.actor("prince.sh/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": [
    "Crawlee"
  ],
  "maxResults": 10,
  "maxResultsShorts": 0,
  "maxResultStreams": 0
}' |
apify call prince.sh/youtube-scraper --silent --output-dataset

```

## MCP server setup

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