# Youtube Video, Channel, Transcript (`scrappy-scraper/youtubescraper-apify`)

The most efficient YouTube parser in terms of cost and performance

- **URL**: https://beta-securitybyobscurity.apify.com/scrappy-scraper/youtubescraper-apify.md
- **Developed by:** [Scrappy Scraper](https://beta-securitybyobscurity.apify.com/scrappy-scraper) (community)
- **Categories:** Videos
- **Stats:** 12 total users, 8 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.
You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#rental-actors

# README

### About this Actor

Supports urls for both `Videos` and `Channels`

Video data include transcript and video+audio urls.

Supports auto-saving results to your S3-compatible storage

The core parser code is available on [GitHub](https://github.com/Scrappy-Scraper/YoutubeScraper) and is free of any licensing restrictions.

### Input Data

```typescript
{
    "urls": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ],
    "proxyUrls": [
        "http://my_user_name:my_password@proxy.provider.io:port"
    ],
    "channelConcurrency": 20,
    "videoConcurrency": 20,
    "transcriptLanguages": [ "en" ],
    "numTranscriptLanguages": 3,

    // S3 params (optional)
    "s3AccessKey": "", "s3SecretKey": "", "s3Bucket": "", "s3Region": "", "s3RootPath": ""
}
```

#### Fields

| name                   |    type    | required | description                                                         |
|------------------------|:----------:|:--------:|---------------------------------------------------------------------|
| urls                   |  string\[]  | **yes**  | YouTube urls. Can be Video or Channel                               |
| proxyUrls              |  string\[]  |    no    | Custom proxyUrls. If not provided, the actor will use Apify's proxy |
| videoConcurrency       |   number   |    no    | Max number of videos to parse at the same time                      |
| channelConcurrency     |   number   |    no    | Max number of channels to parse at the same time                    |
| transcriptLanguages    |  string\[]  |    no    | A list of language codes of preferred language                      |
| numTranscriptLanguages |   number   |    no    | Default: 3. Number of transcript languages to fetch                 |

#### S3 Fields

This actor can save the results to your S3-compatible storage. If you want to enable this feature, fill out the params below; if not, just leave all of them empty.

For security, please limit the access key so that it can only access the necessary S3 buckets; the access key should not have access to any other services.

| name               |  type   |      needed?       | description                                                                                               |
|--------------------|:-------:|:------------------:|-----------------------------------------------------------------------------------------------------------|
| s3AccessKey        | string  |        yes         | S3 Access Key Id                                                                                          |
| s3SecretKey        | string  |        yes         | S3 Secret Key                                                                                             |
| s3Bucket           | string  |        yes         | Bucket name                                                                                               |
| s3Region           | string  |        yes         | e.g: "us-east-1", "us-west-2"                                                                             |
| s3Endpoint         | string  | AWS=no; others=yes | The endpoint url. If you use AWS's S3, leave it empty                                                     |
| s3ForcePathStyle   | boolean |         no         | If you use `Min.io` S3, you might need to set this to true. If not, just leave it empty or set to `false` |
| s3RootPath         | string  |         no         | The basepath inside the bucket to store your data.                                                        |

#### proxyUrls

The format should be `http://username:password@host:port`

Variable session is supported by replacing session id with `:sessionId`.

For example:

```markdown
// Provided by Proxy provider:
http://my_user_name_sid-asdfasdf:my_password@proxy.provider.io:port
http://my_user_name_sid-qwerqwer:my_password@proxy.provider.io:port
http://my_user_name_sid-zxcvzxcv:my_password@proxy.provider.io:port

// What you put in:
http://my_user_name_sid-:sessionId:my_password@proxy.provider.io:port
```

### Output Data

#### Video

`id`, `title`, `description`, `thumbnail`,

`viewCount`, `length`(in seconds),

`transcripts`

#### Channel

`id`, `title`(channel name),

`description`, `thumbnail`,

`videos`

# Actor input Schema

## `urls` (type: `array`):

Video or Channel URLs

## `proxyUrls` (type: `array`):

OPTIONAL. Custom Proxy Urls. Format: `http://username:password@host:port`. Look at the documentation for dynamic session id support.

## `videoConcurrency` (type: `integer`):

Number of videos to process at the same time

## `channelConcurrency` (type: `integer`):

Number of channels to process at the same time

## `transcriptLanguages` (type: `array`):

Your preferred languages for transcripts

## `numTranscriptLanguages` (type: `integer`):

How many languages to include

## `numChannelVideos` (type: `integer`):

How many video titles to include for each channel

## `s3AccessKey` (type: `string`):

S3 Access Key

## `s3SecretKey` (type: `string`):

S3 Secret Access Key

## `s3Bucket` (type: `string`):

Bucket name for the storage

## `s3Region` (type: `string`):

Example "us-east-1"

## `s3Endpoint` (type: `string`):

Please leave it empty if using AWS S3

## `s3ForcePathStyle` (type: `boolean`):

If using min.io, set this to true. Otherwise, leave it empty or set to false

## `s3RootPath` (type: `string`):

The base path in your bucket for storing files

## Actor input object example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "videoConcurrency": 20,
  "channelConcurrency": 20,
  "transcriptLanguages": [
    "en"
  ],
  "numTranscriptLanguages": 3,
  "numChannelVideos": 10,
  "s3RootPath": ""
}
```

# 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 = {
    "urls": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ],
    "videoConcurrency": 20,
    "channelConcurrency": 20,
    "transcriptLanguages": [
        "en"
    ],
    "numTranscriptLanguages": 3,
    "numChannelVideos": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrappy-scraper/youtubescraper-apify").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 = {
    "urls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
    "videoConcurrency": 20,
    "channelConcurrency": 20,
    "transcriptLanguages": ["en"],
    "numTranscriptLanguages": 3,
    "numChannelVideos": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("scrappy-scraper/youtubescraper-apify").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 '{
  "urls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "videoConcurrency": 20,
  "channelConcurrency": 20,
  "transcriptLanguages": [
    "en"
  ],
  "numTranscriptLanguages": 3,
  "numChannelVideos": 10
}' |
apify call scrappy-scraper/youtubescraper-apify --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Youtube Video, Channel, Transcript",
        "description": "The most efficient YouTube parser in terms of cost and performance",
        "version": "0.0",
        "x-build-id": "rTbs6exQf1hZDvXK1"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/scrappy-scraper~youtubescraper-apify/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-scrappy-scraper-youtubescraper-apify",
                "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/scrappy-scraper~youtubescraper-apify/runs": {
            "post": {
                "operationId": "runs-sync-scrappy-scraper-youtubescraper-apify",
                "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/scrappy-scraper~youtubescraper-apify/run-sync": {
            "post": {
                "operationId": "run-sync-scrappy-scraper-youtubescraper-apify",
                "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",
                "required": [
                    "urls"
                ],
                "properties": {
                    "urls": {
                        "title": "YouTube URLs",
                        "minItems": 1,
                        "uniqueItems": true,
                        "type": "array",
                        "description": "Video or Channel URLs",
                        "default": [
                            "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
                        ],
                        "items": {
                            "type": "string"
                        }
                    },
                    "proxyUrls": {
                        "title": "Proxy URLs",
                        "uniqueItems": true,
                        "type": "array",
                        "description": "OPTIONAL. Custom Proxy Urls. Format: `http://username:password@host:port`. Look at the documentation for dynamic session id support.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "videoConcurrency": {
                        "title": "Video Parsing Concurrency",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Number of videos to process at the same time",
                        "default": 20
                    },
                    "channelConcurrency": {
                        "title": "Channel Parsing Concurrency",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Number of channels to process at the same time",
                        "default": 20
                    },
                    "transcriptLanguages": {
                        "title": "Preferred Transcript Languages",
                        "uniqueItems": true,
                        "type": "array",
                        "description": "Your preferred languages for transcripts",
                        "default": [
                            "en"
                        ],
                        "items": {
                            "type": "string"
                        }
                    },
                    "numTranscriptLanguages": {
                        "title": "Number of Transcript Languages",
                        "type": "integer",
                        "description": "How many languages to include",
                        "default": 3
                    },
                    "numChannelVideos": {
                        "title": "Number of Channel Videos",
                        "type": "integer",
                        "description": "How many video titles to include for each channel",
                        "default": 10
                    },
                    "s3AccessKey": {
                        "title": "S3 Access Key Id",
                        "type": "string",
                        "description": "S3 Access Key"
                    },
                    "s3SecretKey": {
                        "title": "S3 Secret Key",
                        "type": "string",
                        "description": "S3 Secret Access Key"
                    },
                    "s3Bucket": {
                        "title": "Bucket Name",
                        "type": "string",
                        "description": "Bucket name for the storage"
                    },
                    "s3Region": {
                        "title": "Region",
                        "type": "string",
                        "description": "Example \"us-east-1\""
                    },
                    "s3Endpoint": {
                        "title": "Endpoint",
                        "type": "string",
                        "description": "Please leave it empty if using AWS S3"
                    },
                    "s3ForcePathStyle": {
                        "title": "Force Path Style",
                        "type": "boolean",
                        "description": "If using min.io, set this to true. Otherwise, leave it empty or set to false"
                    },
                    "s3RootPath": {
                        "title": "Root Path",
                        "type": "string",
                        "description": "The base path in your bucket for storing files",
                        "default": ""
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
