# YouTube Channels Video Scraper (`topaz_sharingan/youtube-video-scraper`) Actor

YouTube Channels Video Scraper is a powerful and user-friendly tool designed to extract valuable data from YouTube channels. This actor allows you to effortlessly collect detailed information about YouTube Videos from a Channel, including video IDs, titles, URLs, views, likes, published times, etc.

- **URL**: https://apify.com/topaz_sharingan/youtube-video-scraper.md
- **Developed by:** [Moses Ceaser](https://apify.com/topaz_sharingan) (community)
- **Categories:** E-commerce, Developer tools
- **Features:** Full permissions
- **Stats:** 127 total users, 0 monthly users, 100.0% runs succeeded, 7 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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 Channel Video Scraper

### Introduction

**YouTube Video Scraper** is a versatile tool designed to extract valuable data from YouTube channels. With this actor, you can effortlessly scrape YouTube video data, including video IDs, titles, URLs, views, thumbnails, durations, published times, and description snippets. Additionally, you can retrieve basic channel information such as the channel title, handle, and URL.

#### Key Features

- Extract YouTube video data with ease.
- Retrieve essential channel information.
- Configure the maximum number of videos to scrape.
- Control the rate of requests with an optional setting.

#### Typical Use Cases

- **Content Analysis**: Analyze the performance of YouTube videos from specific channels.
- **Competitive Research**: Monitor your competitors' video content and engagement.
- **Content Aggregation**: Collect YouTube video data for research or reporting purposes.

### Inputs

#### Data Input

The actor takes the following inputs:

- **Start URLs**: A list of YouTube channel names or URLs you want to scrape videos from.
- **Number of Videos**: The maximum number of YouTube videos to scrape from each specified channel.
- **Maximum Requests per Time**: An optional setting to control the rate of requests to YouTube's servers. Use this to prevent overloading the server with too many requests in a short time.
- **All Videos (Optional)**: An optional boolean setting to scrape all videos from the channel (true) or only the most recent ones (false).

#### Input Examples

**Start URLs**:

- Example 1: `["Filmento"]`
- Example 2: `["https://www.youtube.com/@Filmento"]`

**Number of Videos**:

- Example 1: `50`
- Example 2: `100`

**Maximum Requests per Time** (optional):

- Example 1: `5 requests per second`
- Example 2: `No limit (default)`

**All Videos (Optional)**:

- Example 1: `false`
- Example 2: `true`

### Outputs

The actor produces the following outputs:

- **YouTube Video Data**: A JSON array containing details of each scraped YouTube video, including video IDs, titles, URLs, views, thumbnails, durations, published times, and description snippets.
- **Channel Details**: A JSON object with basic channel information, including the channel title, handle, and URL.

#### Output Examples

**YouTube Video Data**:

```json
[
    {
        "video_id": "TfxGyz3SBAw",
        "video_title": "How I made $12,000 using ICT Concepts | Weekly Review",
        "video_url": "https://www.youtube.com/watch?v=TfxGyz3SBAw",
        "views": "11,305 views",
        "likes": "571",
        "video_thumbnail": "https://i.ytimg.com/vi/TfxGyz3SBAw/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBVl9RgxcEGyfwoQ-ZCwV2CPvj1hA",
        "video_duration": "36 minutes, 25 seconds",
        "published_time": "17 hours ago",
        "description_snippet": "Reviewing my trades from last week as I had my best performance on funded accounts ever. \n\nThe journal I use is Tradezella -- Get 10% off the monthly plan with code TANJA10 and 20% off the...",
        "channel_info": {
            "channel_title": "Tanja Trades",
            "channel_handle": "@TanjaTrades",
            "channel_url": "https://www.youtube.com/@TanjaTrades"
        }
    },
    // Additional videos...
]
```

## Usage

### How to Run the Actor

1. Go to [Apify](https://apify.com) and log in or create an account if you don't have one.
2. Create a new task and select the "YouTube Video Scraper" actor.
3. Configure the actor's input settings by providing the YouTube channel names or URLs, specifying the maximum number of videos to scrape, and adjusting other optional settings.
4. (Optional) Adjust the maximum number of requests per time if needed.
5. Start the task and wait for it to complete.
6. Once the task is finished, you can access the scraped data in the task's dataset.

### How to Interpret the Actor's Results

The actor will provide you with a JSON dataset containing the scraped YouTube video data and channel details. Each video will have its own set of properties, as described in the "Outputs" section.

### Examples

#### Example 1: Scraping YouTube Videos from a Channel

In this example, we will scrape YouTube video data from the channel "Filmento" with a limit of 50 videos.

```json
{
    "startUrls": ["Filmento"],
    "number_of_videos": 50,
    "maxRequest": 5,
    "all_videos": false
}
```

#### Example 2: Scraping All Videos with Rate Limit

In this example, we will scrape all videos from a channel with a rate limit of 5 requests per second to avoid overloading the server.

```json
{
    "startUrls": ["https://www.youtube.com/Channel"],
    "number_of_videos": 100,
    "maxRequest": 5,
    "all_videos": true
}

```

### Troubleshooting

#### Common Problems and Solutions

- **Problem:** The actor is not returning any data.
  - **Solution:** Check if the YouTube channel names or URLs are correct. Ensure that the channels have videos available.

- **Problem:** Rate limiting issues.
  - **Solution:** If you encounter rate limiting issues, try adjusting the "Maximum Requests per Time" input to a lower value or contact Apify support for assistance.

### Additional Information

#### Links to Related Resources

- [Apify](https://apify.com)
- [Apify Documentation](https://apify.com/docs)

#### Acknowledgements

This actor is powered by Apify, a leading web scraping and automation platform. Special thanks to the Apify team for their contributions.

# Actor input Schema

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

YouTube channel URLs to scrape videos from (e.g., https://www.youtube.com/@ChannelName).

## `number_of_videos` (type: `integer`):

Maximum number of videos to extract from each channel

## `maxRequest` (type: `integer`):

Maximum number of requests at a time

## `all_videos` (type: `boolean`):

Toggle this option to extract all available videos from the channel. If disabled, only the number specified above will be extracted.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.youtube.com/@Apify"
  ],
  "number_of_videos": 5,
  "maxRequest": 5,
  "all_videos": 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 = {
    "startUrls": [
        "https://www.youtube.com/@Apify"
    ],
    "number_of_videos": 5,
    "maxRequest": 5
};

// Run the Actor and wait for it to finish
const run = await client.actor("topaz_sharingan/youtube-video-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 = {
    "startUrls": ["https://www.youtube.com/@Apify"],
    "number_of_videos": 5,
    "maxRequest": 5,
}

# Run the Actor and wait for it to finish
run = client.actor("topaz_sharingan/youtube-video-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 '{
  "startUrls": [
    "https://www.youtube.com/@Apify"
  ],
  "number_of_videos": 5,
  "maxRequest": 5
}' |
apify call topaz_sharingan/youtube-video-scraper --silent --output-dataset

```

## MCP server setup

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