# Youtube Shorts Scraper (`newbs/youtube-shorts`)

Unlock valuable insights with our YouTube video data extraction tool. Effortlessly gather crucial information like video title, social links, description, and more youtube information ..... Enhance your analysis and decision-making with comprehensive data from this youtube scraper actor.

- **URL**: https://beta-securitybyobscurity.apify.com/newbs/youtube-shorts.md
- **Developed by:** [Newbs](https://beta-securitybyobscurity.apify.com/newbs) (community)
- **Categories:** Social media, Videos
- **Stats:** 315 total users, 24 monthly users, 100.0% runs succeeded, 11 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

$30.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

## YouTube Scraper using Puppeteer

### Overview

This Apify actor uses Puppeteer to scrape YouTube shorts for a specified channel and number of videos. The output of the actor includes details on each video scraped.

### YouTube Channel Scraper ⚙️

For scraping YouTube regular videos specifically, please refer to the [YouTube Channel Scraper](https://apify.com/newbs/youtube-channel).

### Input

The actor takes in the following input:

- `channelName` (required) - The name of the channel to scrape videos from.
- `numberOfVideos` (required) - The number of videos to scrape.

### Output

The actor outputs an array of objects, where each object represents a single video. The object includes the following details for each video:

- `title` - The title of the video.
- `description` - The description of the video.
- `coverImage` - The URL of the Cover image.
- `videoUrl` - The URL of the video.
- `author` - The name of the author of the video.
- `viewCount` - The number of views the video has.
- `likeCount` - The number of likes the video has.
- `commentCount` - The number of comments the video has.
- `subscriberCount` - The number of subscribers the channel has.
- `publishedAt` - The date the video was published.
- `amountOfVideos` - The total amount of all videos in the youtube channel including live and shorts
- `channelInfo` - The global information about the channel

### Usage

To use this actor, you can set up a task on Apify and configure the input parameters as desired. Once the task is started, the actor will scrape the specified number of videos for the specified channel and output the details in the format described above.

#### Example Input

```json
{
  "channelName": "National Geographic",
  "numberOfVideos": 10
}
```

#### Example Output

```json
[
  {
	"title": "The Top 10 TV shows on #Netflix this week",
	"author": "@netflix",
	"videoUrl": "https://www.youtube.com/shorts/HJ5phNtRIZs",
	"coverImage": "https://i.ytimg.com/vi/HJ5phNtRIZs/oar2.jpg?sqp=-oaymwEdCJUDENAFSFWQAgHyq4qpAwwIARUAAIhCcAHAAQY=&rs=AOn4CLCbKbpOxW_Ta9h0t6trJfi6___mpw",
	"subscriberCount": 27200000,
	"likeCount": 13,
	"description": "#shorts SUBSCRIBE: http://bit.ly/29qBUt7 About Netflix: Netflix is one of the world's leading entertainment services with over 247 million paid memberships in over 190 countries enjoying TV series, films and games across a wide variety of genres and languages. Members can play, pause and resume watching as much as they want, anytime, anywhere, and can change their plans at any time. The Top 10 TV shows on #Netflix this week https://www.youtube.com/@Netflix Moins Plus",
	"viewCount": 27979,
	"commentCount": 27,
	"publishedAt": "2023-10-19",
	"id": "HJ5phNtRIZs",
	"amountOfVideos": null,
	"profilePicture": null,
	"channelInfo": {
		"actifFrom": "Actif depuis le 17 juil. 2012",
		"viewCounter": "7 569 331 655 vues",
		"channelDescription": "Description GEEKED WEEK is BACK Get Netflix's latest trailers and updates here! Netflix is the world's leading streaming entertainment service with over 209 million paid memberships in over 190 countries enjoying TV series, documentaries, feature films , and games across a wide variety of genres and languages. Members can watch as much as they want, anytime, anywhere, on any internet-connected screen. Members can play, pause and resume watching at any time.",
		"country": "États-Unis",
		"link": {
			"Netflix": "signup.netflix.com",
			"Facebook": "facebook.com/netflixus",
			"Twitter": "twitter.com/netflix",
			"Instagram": "instagram.com/netflix",
			"Tumblr": "netflix.tumblr.com"
		}
	}
}
]
```

### Disclaimer

Please note that the use of this actor and any data obtained through its use is at your own risk. The developer of this actor is not responsible for any consequences resulting from the use of this actor and the data it generates. It is your responsibility to ensure that you comply with all applicable laws and regulations governing the use of such data.

# Actor input Schema

## `channel` (type: `array`):

An array of YouTube channel names .

## `hashtag` (type: `array`):

An array of hashtags to be used in the search query.

## `needVideoDetails` (type: `boolean`):

If you want to scrape video details like title, description, etc. then set it to true. It will take more time to scrape the data.

## `numberOfResults` (type: `integer`):

The number of results you want from the channel.

## Actor input object example

```json
{
  "channel": [
    "https://www.youtube.com/@adidas/videos",
    "zara"
  ],
  "hashtag": [
    "fashion",
    "style"
  ],
  "numberOfResults": 2
}
```

# 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 = {
    "channel": [
        "https://www.youtube.com/@adidas/videos",
        "zara"
    ],
    "hashtag": [
        "fashion",
        "style"
    ],
    "numberOfResults": 2
};

// Run the Actor and wait for it to finish
const run = await client.actor("newbs/youtube-shorts").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 = {
    "channel": [
        "https://www.youtube.com/@adidas/videos",
        "zara",
    ],
    "hashtag": [
        "fashion",
        "style",
    ],
    "numberOfResults": 2,
}

# Run the Actor and wait for it to finish
run = client.actor("newbs/youtube-shorts").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 '{
  "channel": [
    "https://www.youtube.com/@adidas/videos",
    "zara"
  ],
  "hashtag": [
    "fashion",
    "style"
  ],
  "numberOfResults": 2
}' |
apify call newbs/youtube-shorts --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Youtube Shorts Scraper",
        "description": "Unlock valuable insights with our YouTube video data extraction tool. Effortlessly gather crucial information like video title, social links, description, and more youtube information ..... Enhance your analysis and decision-making with comprehensive data from this youtube scraper actor.",
        "version": "0.0",
        "x-build-id": "umsbWqCv6kbMdx0Z1"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/newbs~youtube-shorts/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-newbs-youtube-shorts",
                "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/newbs~youtube-shorts/runs": {
            "post": {
                "operationId": "runs-sync-newbs-youtube-shorts",
                "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/newbs~youtube-shorts/run-sync": {
            "post": {
                "operationId": "run-sync-newbs-youtube-shorts",
                "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": {
                    "channel": {
                        "title": "Channels",
                        "type": "array",
                        "description": "An array of YouTube channel names .",
                        "items": {
                            "type": "string"
                        }
                    },
                    "hashtag": {
                        "title": "Hashtags  , if hashtags are provided then it will search for the hashtags in the search query and not search FOR CHANNELS",
                        "type": "array",
                        "description": "An array of hashtags to be used in the search query.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "needVideoDetails": {
                        "title": "Video details. If you want to scrape video details like title, description, etc. then set it to true. It will take more time to scrape the data.",
                        "type": "boolean",
                        "description": "If you want to scrape video details like title, description, etc. then set it to true. It will take more time to scrape the data."
                    },
                    "numberOfResults": {
                        "title": "Number of results  (no limit)",
                        "type": "integer",
                        "description": "The number of results you want from the channel."
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
