# Youtube Scraper (Pay Per Result) (`apidojo/youtube-scraper`) Actor

Experience unparalleled efficiency and depth with its ultra-fast capabilities in searching, URL, playlist, channel, and profile scraping. It comes equipped with a variety of filters to customize your data collection precisely. Plus, it's incredibly affordable at only $0.50 per 1000 videos!

- **URL**: https://apify.com/apidojo/youtube-scraper.md
- **Developed by:** [API Dojo](https://apify.com/apidojo) (community)
- **Categories:** Social media, Videos, Lead generation
- **Stats:** 30,328 total users, 362 monthly users, 82.5% runs succeeded, 344 bookmarks
- **User rating**: 3.29 out of 5 stars

## Pricing

$0.50 / 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.

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: Unlock the secret potential. Streamlined Data, Seamless Support, No Hassles.

Introducing Youtube Scraper, your go-to tool for accessing comprehensive [YouTube](https://youtube.com) data. Experience unparalleled efficiency and depth with its ultra-fast capabilities in searching, URL, playlist, channel, and profile scraping. It comes equipped with a variety of filters to customize your data collection precisely. Perfect for researchers demanding in-depth [YouTube](https://youtube.com) analytics or businesses seeking to understand market trends and consumer opinions, Youtube Scraper stands as your essential tool. Plus, it's incredibly affordable at only $0.50 per 1000 videos!

### ℹ️ Disclaimer

This actor is specifically fine-tuned for extracting videos from [YouTube](https://youtube.com) and comes with a comprehensive suite of tools. We provide not only that, but also top-notch maintenance and dedicated support. No nonsense – just pure data. You name it, we get it.

#### Important Note About Usage

We want you to get the most out of our scraper while also keeping the system fair and efficient for everyone. Please follow these simple rules:

- Each query or startUrl must fetch **at least 10 videos**. Running with fewer makes the request too costly and may trigger rate-limits.
- **Single video URLs** are not allowed.
- We’re working on improvements, so this limit will be relaxed soon.
- **Free users**: Limited to **5 runs per month**, each capped at **10 items**

### 🐉 Features and Functionality

- Extreme efficiency, unmatched flexibility. Suitable for all types of applications and usages.
- **Query Wizard**: Create queries effortlessly without requiring knowledge of complex search terms, or similar. Within the easy usage, you can build your queries without hassle.
- Support for multiple languages and countries to accommodate global requirements. Customization as its best.
- A wide array of filters at your disposal, including options for timeframes, targeting, and more.
- In-depth user/channel information for deep data analysis.
- Precise data pinpointing through geo-targeting and geolocation support.
- Enriched results, vital information in lightning speed.

### 🆓 Demo Mode & Free Users

Users on the Free Plan can use the actor only in Demo Mode. **Free users can run the actor up to 5 times per month**, with each run capped at a maximum of 10 items — just enough to test it out. To use this actor without limitations, subscribe to a paid plan on Apify. [Subscribe here](https://apify.com/pricing?fpr=yhdrb).

### 👹 Competitors

Well, this is the place where we should go crazy. But we don't. Try it, and you will see the difference. Please be aware that although all the tests used identical inputs and resources, the recorded speeds and costs may differ and might not accurately reflect the real metrics.

| Feature | 🏯 Youtube Scraper | Streamers Youtube Scraper | Alexey YouTube and All Videos PRO Scraper
| ----- | ---- | ----------- | -------------|
| Query Wizard  | ✔️ | ❌ | ❌ |
| Search Data Range | Unlimited | Unlimited | N/A |
| Price Per 100k Results (Search) | $50 | $500 | Pay for Usage |
| Price Per 100k Results (Search URL) | $50 | $500 | Pay for Usage |
| Price Per 100k Results (Channel URL) | $50 | $500 | Pay for Usage |
| Price Per 100k Results (Playlist URL) | $50 | $500 | Pay for Usage |
| Videos Per Second (Search) | 10 | 6 | 2 |
| Videos Per Second (Search URL) | 19 | 5 | 3 |
| Videos Per Second (Channel URL) | 16 | N/A | 4 |
| Videos Per Second (Playlist URL) | 14 | 9 | 8 |
| Pricing Plan  | $0.10 per 1k results | $5 per 1k results | Pay for Usage |
| Maximum Videos Per Input Limit  | ✔️ | ✔️ | ❌ |
| Maximum Videos Total Limit  | ✔️ | ✔️ | ❌ |
| Collect Detailed User Info  | ✔️ | ✔️ | ✔️ |
| Scrape Playlist URLs  | ✔️ | ❌ | ✔️ |
| Scrape From Search URLs  | ✔️ | ❌ | ❌ |
| Scrape From Channel URLs  | ✔️ | ❌ | ✔️ |
| Scrape From Youtube URLs | ✔️ | ❌ | ✔️ |
| Scrape From Shorts URLs | ✔️ | ❌ | ❌ |
| Scrape From Youtube Handles | ✔️ | ❌ | ❌ |
| Advanced Channel Information | ✔️ | ✔️ | ✔️ |
| No Proxy Required | ✔️ | ❌ | ✔️ |

### 🎎 Who needs this?

[YouTube](https://youtube.com) Scraper is designed to provide exceptional efficiency, speed, and cost-effectiveness for a diverse range of users:

- **Digital Marketing Professionals:** They can use the scraper to analyze trends, monitor competitor activity, and gather insights about popular content, aiding in the creation of targeted marketing campaigns.
- **Media Analysts:** By scraping [YouTube](https://youtube.com) data, media analysts can track the performance of various media content, understand viewer preferences, and provide insights for content strategy.
- **Academic Researchers:** Researchers focusing on media studies, cultural trends, or communication can use the scraper to collect data on [YouTube](https://youtube.com) content, aiding in their academic research.
- **Content Creators:** [YouTube](https://youtube.com) creators can use this tool to analyze trends, understand what content is popular, and tailor their own content strategies accordingly.
- **Market Researchers:** Market researchers can use the tool to understand consumer preferences and trends by analyzing the most viewed and engaged content on [YouTube](https://youtube.com).
- **Brand Managers:** This tool can help brand managers monitor how their brand and competitors are portrayed on [YouTube](https://youtube.com), allowing for effective brand management.
- **SEO Specialists:** By analyzing popular keywords and trends on [YouTube](https://youtube.com), SEO specialists can optimize video content for better search engine rankings.
- **Event Organizers:** Organizers can use the scraper to understand popular themes and topics, helping them plan events or webinars that resonate with their target audience.
- **Music Industry Professionals:** This tool can help in understanding current music trends, popular artists, and emerging genres, aiding in talent scouting and marketing strategies.
- **Lead Generation Specialists:** They can identify potential leads by analyzing popular content and viewer demographics, helping businesses target their marketing efforts more effectively.

### 🍜 Output Example

```
{
	"type": "video",
	"id": "wwSzpaTHyS8",
	"title": "Did The Future Already Happen? - The Paradox of Time",
	"status": "OK",
	"url": "https://www.youtube.com/watch?v=wwSzpaTHyS8",
	"description": "Go to https://brilliant.org/nutshell/ to dive deeper into these topics and more with a free 30-day trial + 20% off for the first 200 people! \nThis video was sponsored by Brilliant. Thanks a lot for the support!\n\nSources & further reading:\nhttps://sites.google.com/view/sources...\n\nIs your future already written? Do your past, present, and future all exist right now? Surprisingly, the answer could be yes. \nLet's take a look at what time is and how it works – in our first video of the year!\n\nOUR CHANNELS\n▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\nGerman:        https://kgs.link/youtubeDE\nSpanish:        https://kgs.link/youtubeES\nFrench:          https://kgs.link/youtubeFR\nPortuguese:  https://kgs.link/youtubePT\nArabic:           https://kgs.link/youtubeAR\nHindi:             https://kgs.link/youtubeHI\nJapanese:     https://kgs.link/youtubeJA\nKorean:          https://kgs.link/youtubeKO\n\n\nHOW CAN YOU SUPPORT US?\n▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\nThis is how we make our living and it would be a pleasure if you support us!\n\nGet Products designed with ❤ https://shop-us.kurzgesagt.org  \nJoin the Patreon Bird Army 🐧  https://kgs.link/patreon  \n\n\nDISCUSSIONS & SOCIAL MEDIA\n▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\nTikTok:           https://kgs.link/tiktok\nReddit:            https://kgs.link/reddit\nInstagram:     https://kgs.link/instagram\nTwitter:           https://kgs.link/twitter\nFacebook:      https://kgs.link/facebook\nDiscord:          https://kgs.link/discord\nNewsletter:    https://kgs.link/newsletter\n\n\nOUR VOICE\n▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\nThe Kurzgesagt voice is from \nSteve Taylor:  https://kgs.link/youtube-voice\n\n\nOUR MUSIC ♬♪\n▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n700+ minutes of Kurzgesagt Soundtracks by Epic Mountain:\n\nSpotify:            https://kgs.link/music-spotify\nSoundcloud:   https://kgs.link/music-soundcloud\nBandcamp:     https://kgs.link/music-bandcamp\nYoutube:          https://kgs.link/music-youtube\nFacebook:       https://kgs.link/music-facebook\n\nThe Soundtrack of this video:\nSoundCloud: https://bit.ly/49cZSo0\nBandcamp: https://bit.ly/3vRr6lv\n\nIf you want to help us caption this video, please send subtitles to subtitle@kurzgesagt.org\nYou can find info on what subtitle files work on YouTube here:\nhttps://support.google.com/youtube/an...\nThank you!\n\n🐦🐧🐤 PATREON BIRD ARMY 🐤🐧🐦\n▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\nMany Thanks to our wonderful Patreons (from http://kgs.link/patreon) who support us every month and made this video possible:\nJuan, DasBeast97, H Henning, steco, Claudio Erba, Jake Pearson, Dominic Harnisch, Felinae Tang, Lana the Blonde Farmer, Pierre Persson, Dante Gilbert, Julian Rupp, Abhinav Sahu, Jason Woods, Rog Simon Jr., Kai Kirylo, Birk Flaten, Ira Silchenko, Victoria Yoon, D, Rondie, Lorenzo Zama, Adiv Data, Knilz Maierling, Nicolas Girardeau, Ella McKinney, Cantemir Zegrea, 呱呱呱呱呱, Stefani, applestooranges, Dezwijger1982 ., Anindya Maiti, Caleb Round, Nick Swanlaw, Jon Prictoe, Ivy blue, marshmellerz13 ,Mind_Blocker10, Jack Gilvey, kate keaney, Wassili, Mead Landis, Cracar nar, Bartas Beitas, Saanzan, kevin garner, Steven Goins, Ryan, OD, Nikolay, Kalihman Eitan, 101 Rebel, dark, Barry Corbett, Rog Simon Jr.",
	"duration": 755,
	"views": 6501854,
	"likes": 282499,
	"channel": {
		"id": "UCsXVk37bltHxD1rDPwtNM8Q",
		"name": "Kurzgesagt – In a Nutshell",
		"url": "http://www.youtube.com/@kurzgesagt"
	},
	"isLive": false,
	"isPrivate": false,
	"thumbnails": [
		{
			"url": "https://i.ytimg.com/vi/wwSzpaTHyS8/maxresdefault.jpg",
			"width": 1920,
			"height": 1080
		}
	],
	"streamingData": {
		"expiresInSeconds": "2024-03-11T15:09:53.418Z",
		"formats": [
			{
				"itag": 18,
				"url": "https://rr1---sn-cnoa-qxas.googlevideo.com/videoplayback?expire=1710169853&ei=ncruZZLeAofMhcIP3YaUiAY&ip=35.203.255.225&id=o-AFLPxUtTXF_xS1Q0NT753E3lkcy-T6h5IQx4coN7eaX2&itag=18&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&mh=bi&mm=31%2C26&mn=sn-cnoa-qxas%2Csn-a5m7lnl6&ms=au%2Conr&mv=u&mvi=1&pl=27&pcm2=yes&spc=UWF9f_gZumAVwW_iavCNKmJvYhxUjsiSCKkdTs0KXZH_QaI&vprv=1&svpuc=1&mime=video%2Fmp4&ns=9iRrCcfesOHSfgot5W_T8usQ&gir=yes&clen=47098486&ratebypass=yes&dur=754.718&lmt=1706868813161885&mt=1710147731&fvip=4&fexp=24007246&c=WEB&sefc=1&txp=5538434&n=GvsK5UzWG2ZidGgk&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cxpc%2Cpcm2%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cns%2Cgir%2Cclen%2Cratebypass%2Cdur%2Clmt&sig=AJfQdSswRgIhAMf7hvoy15_ifYOw29q2A-_QgmaD3gSQ66Ydfh9R0P77AiEAvL2DgMjYX6RvXvj0e9paKIhHM7cxveP5aFVi3HHGREw%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl&lsig=APTiJQcwRgIhAKqjK52B7c7CBfK4s7gtXvEPrraIkYh1kFHtkMulRqyXAiEA4KygiLd6Nf9acLRp0wCZSuc4f9VK_K1pbVGWv_PfhnI%3D",
				"mimeType": "video/mp4; codecs=\"avc1.42001E, mp4a.40.2\"",
				"bitrate": 499277,
				"width": 640,
				"height": 360,
				"lastModified": "2024-02-02T10:13:33.161Z",
				"quality": "medium",
				"fps": 30,
				"qualityLabel": "360p",
				"audioQuality": "AUDIO_QUALITY_LOW",
				"approxDurationMs": 754718,
				"audioSampleRate": 44100,
				"audioChannels": 2
			}
		]
	},
	"embedUrl": "https://www.youtube.com/embed/wwSzpaTHyS8",
	"isFamilySafe": true,
	"publishDate": "Jan 30, 2024",
	"uploadDate": "Jan 30, 2024",
	"captions": {
		"captionTracks": [
			{
				"base_url": "https://www.youtube.com/api/timedtext?v=wwSzpaTHyS8&ei=ncruZZLeAofMhcIP3YaUiAY&caps=asr&opi=112496729&xoaf=5&hl=en&ip=0.0.0.0&ipbits=0&expire=1710173453&sparams=ip,ipbits,expire,v,ei,caps,opi,xoaf&signature=DE904BA609B418E75C21D755F16A49ED5412436E.E76B50CB0DC120243232581CDDA3C61D2F93EF4E&key=yt8&lang=en",
				"name": {
					"text": "English"
				},
				"vss_id": ".en",
				"language_code": "en",
				"is_translatable": true
			}
		],
		"audioTracks": [
			{
				"caption_track_indices": [
					0,
					2,
					3,
					4,
					1
				]
			}
		],
		"translationLanguages": [
			{
				"language_code": "af",
				"language_name": {
					"text": "Afrikaans"
				}
			}
		]
	}
}
```

### 🍚 Input Parameters

| Field | Type | Description | Default value
| ----- | ---- | ----------- | -------------|
startUrls | array | Paste the [YouTube](https://youtube.com) URLs, and get the results immediately. Channel, Playlist, Shorts and Search URLs are supported. | `[]` |
youtubeHandles | array | Handles/Channels that you want to search on [YouTube](https://youtube.com). | `[]` |
getTrending | Boolean | Retrieve the Trending Videos directly from [YouTube](https://youtube.com). | `false` |
fetchLatestMetadata | Boolean | Makes an extra request for every video to fetch its latest view and like counts and adds them to the video as `latestMetadata`. | `false` |
keywords | array | Search keywords you want to search on [YouTube](https://youtube.com). | `[]` |
gl | string | Location for the search results, which is passed to [YouTube](https://youtube.com) as the gl URL query parameter. (US, AF, AL, etc...) | `us` |
hl | string | Language for the search results, which is passed to [YouTube](https://youtube.com) as the hl URL query parameter. (af, tr, de, etc...) | `en` |
uploadDate | string | Upload date for the search results, which is passed to [YouTube](https://youtube.com) as the upload date URL query parameter. (any, hour, today, week, month, year). It only works with keyword search, not with profiles or startUrls. | `all` |
duration | string | Duration of the video for the search results, which is passed to [YouTube](https://youtube.com) as the duration URL query parameter. (any, short, long) | `all` |
features | string | Features for video. (any, 4k, hd, live, movie, cc, 3d, hdr, location, purchased, subtitles, vr180, vr360) | `all` |
sort | string | Sorts search results by the given option. Only works with search keywords. | `r` |
maxItems | number | Maximum number of items that you want to receive as output | `Infinity` |
customMapFunction | String | Function that takes each of the objects as argument and returns data that will be mapped by the function itself. This function is not intended for filtering, please don't use it for filtering purposes or you will get banned automatically. | `null` |

### 🔧 Troubleshooting

- **Getting Few Results?** Check "Maximum number of items on output" (`maxItems`) field, and "Maximum charged results" fields. These two fields enable you to handle the total number of results. Leaving both empty will result infinite results.
- **Are Some Outputs Missing?** Ensure that you review all fields, not just the overview. You can navigate to the "Storage" tab and select either "Download the results" or "Open in a New Tab."
- **Getting No Results?** Confirm that your parameters are not overly restrictive.
- **Not Receiving New Items After a Large Batch?** Examine the log for messages like "Logging is too fast, some lines were skipped." If you encounter this issue, consider scraping smaller amounts of data to avoid it.

### 📞 Contact and Feature Requests

If you need any sort of support, please send an email to <apidojo10@gmail.com>. You name it, we get it.

### 🚨 Terms

- You should fetch min of 10 items per keyword/youtubeHandles/startUrls.
- You shouldn't batch more than 5 keyword/youtubeHandles/startUrls into the same run.
- You should have max 1 concurrent runs at the same time. If you really need to run more, don't exceed 2.
- You need to wait a couple of minutes between your runs.

### 🈴 Other Actors you might want to check

- [Twitter Scraper Lite](https://apify.com/apidojo/twitter-scraper-lite?fpr=yhdrb)
- [Youtube Playlist Scraper](https://apify.com/apidojo/youtube-playlist-scraper?fpr=yhdrb)
- [Youtube Comments Scraper](https://apify.com/apidojo/youtube-comments-scraper?fpr=yhdrb)
- [Youtube Channel Scraper](https://apify.com/apidojo/youtube-channel-scraper?fpr=yhdrb)
- [TikTok Scraper](https://apify.com/apidojo/tiktok-scraper?fpr=yhdrb)
- [TikTok User Scraper](https://apify.com/apidojo/tiktok-user-scraper?fpr=yhdrb)
- [Instagram Comments Scraper](https://apify.com/apidojo/instagram-comments-scraper?fpr=yhdrb)

# Actor input Schema

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

Paste the Youtube URLs, and get the results immediately. Video, Channel, Playlist, Shorts and Search URLs are supported.

## `youtubeHandles` (type: `array`):

Youtube handles that you want to search on Youtube (e.g. @MrBeast, @babishculinaryuniverse)

## `includeShorts` (type: `boolean`):

When searching for channel videos or by keywords, includes shorts.

## `fetchLatestMetadata` (type: `boolean`):

When enabled, makes an extra request for every video to fetch its latest view and like counts and adds them to the video as latestMetadata.

## `getTrending` (type: `boolean`):

If selected, returns trending videos.

## `keywords` (type: `array`):

Search keywords you want to search on YouTube.

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

Location for the search results, which is passed to YouTube as the gl URL query parameter. (US, AF, AL, etc...)

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

Language for the search results, which is passed to YouTube as the hl URL query parameter. (af, tr, de, etc...)

## `uploadDate` (type: `string`):

Upload date for the search results, which is passed to YouTube as the upload date URL query parameter. (any, hour, today, week, month, year) Only works with search keywords.

## `duration` (type: `string`):

Duration of the video for the search results, which is passed to YouTube as the duration URL query parameter. (any, short, long)

## `features` (type: `string`):

Features for video. (any, 4k, hd, live, movie, cc, 3d, hdr, location, purchased, subtitles, vr180, vr360)

## `sort` (type: `string`):

Sorts search results by the given option. Only works with search keywords.

## `maxItems` (type: `integer`):

Maximum number of items that you want as output.

## `customMapFunction` (type: `string`):

Function that takes each of the objects as argument and returns data that will be mapped by the function itself. This function is not intended for filtering, please don't use it for filtering purposes or you will get banned automatically.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.youtube.com/results?search_query=never+gonna+give+you+up",
    "https://www.youtube.com/watch?v=xuCn8ux2gbs",
    "https://www.youtube.com/channel/UCsXVk37bltHxD1rDPwtNM8Q",
    "https://www.youtube.com/watch?v=kXYiU_JCYtU&list=PL6Lt9p1lIRZ311J9ZHuzkR5A3xesae2pk",
    "https://www.youtube.com/shorts/vVTa1_hm4n4",
    "https://www.youtube.com/results?search_query=recipes",
    "https://www.youtube.com/@nike/shorts"
  ],
  "youtubeHandles": [
    "@MrBeast"
  ],
  "keywords": [
    "pixel art"
  ],
  "gl": "us",
  "hl": "en",
  "uploadDate": "all",
  "duration": "all",
  "features": "all",
  "sort": "r",
  "maxItems": 1000,
  "customMapFunction": "(object) => { return {...object} }"
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# 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/results?search_query=never+gonna+give+you+up",
        "https://www.youtube.com/watch?v=xuCn8ux2gbs",
        "https://www.youtube.com/channel/UCsXVk37bltHxD1rDPwtNM8Q",
        "https://www.youtube.com/watch?v=kXYiU_JCYtU&list=PL6Lt9p1lIRZ311J9ZHuzkR5A3xesae2pk",
        "https://www.youtube.com/shorts/vVTa1_hm4n4",
        "https://www.youtube.com/results?search_query=recipes",
        "https://www.youtube.com/@nike/shorts"
    ],
    "youtubeHandles": [
        "@MrBeast"
    ],
    "keywords": [
        "pixel art"
    ],
    "uploadDate": "all",
    "duration": "all",
    "features": "all",
    "sort": "r",
    "maxItems": 1000,
    "customMapFunction": (object) => { return {...object} }
};

// Run the Actor and wait for it to finish
const run = await client.actor("apidojo/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 = {
    "startUrls": [
        "https://www.youtube.com/results?search_query=never+gonna+give+you+up",
        "https://www.youtube.com/watch?v=xuCn8ux2gbs",
        "https://www.youtube.com/channel/UCsXVk37bltHxD1rDPwtNM8Q",
        "https://www.youtube.com/watch?v=kXYiU_JCYtU&list=PL6Lt9p1lIRZ311J9ZHuzkR5A3xesae2pk",
        "https://www.youtube.com/shorts/vVTa1_hm4n4",
        "https://www.youtube.com/results?search_query=recipes",
        "https://www.youtube.com/@nike/shorts",
    ],
    "youtubeHandles": ["@MrBeast"],
    "keywords": ["pixel art"],
    "uploadDate": "all",
    "duration": "all",
    "features": "all",
    "sort": "r",
    "maxItems": 1000,
    "customMapFunction": "(object) => { return {...object} }",
}

# Run the Actor and wait for it to finish
run = client.actor("apidojo/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 '{
  "startUrls": [
    "https://www.youtube.com/results?search_query=never+gonna+give+you+up",
    "https://www.youtube.com/watch?v=xuCn8ux2gbs",
    "https://www.youtube.com/channel/UCsXVk37bltHxD1rDPwtNM8Q",
    "https://www.youtube.com/watch?v=kXYiU_JCYtU&list=PL6Lt9p1lIRZ311J9ZHuzkR5A3xesae2pk",
    "https://www.youtube.com/shorts/vVTa1_hm4n4",
    "https://www.youtube.com/results?search_query=recipes",
    "https://www.youtube.com/@nike/shorts"
  ],
  "youtubeHandles": [
    "@MrBeast"
  ],
  "keywords": [
    "pixel art"
  ],
  "uploadDate": "all",
  "duration": "all",
  "features": "all",
  "sort": "r",
  "maxItems": 1000,
  "customMapFunction": "(object) => { return {...object} }"
}' |
apify call apidojo/youtube-scraper --silent --output-dataset

```

## MCP server setup

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