# YouTube Scraper - Videos, Shorts, Channels & Playlists (`amethys/youtube-scraper`) Actor

\[$1.5/1000] Scrape YouTube videos, shorts, live streams, channels and playlists from links or @handles: views, likes, tags, chapters, captions list, related videos and channel stats. No key needed; your own free API key adds comments and full pagination.

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

## Pricing

from $1.50 / 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/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: videos, shorts, live streams, channels and playlists

Paste any mix of YouTube links, IDs or @handles and get clean, structured data back. Each video is opened in full, so you get much more than what the listing card shows.

- **Works without a key.** It reads YouTube's public pages: exact views and likes, tags, chapters, caption languages, related videos, channel stats and links.
- **Add your own free YouTube Data API key (optional)** to unlock comments with replies, every video of a channel or playlist, extra exact statistics, and per-country most-popular charts. You use your own free daily quota and pay nothing extra.

#### What you can scrape

| Input | What you get |
|---|---|
| Video link, `youtu.be` link, Shorts or Live link, or video ID | One full video item |
| Channel (`@handle`, `/channel/UC...`, `/c/...`, `/user/...`) | A channel profile, plus the videos, shorts, live streams and playlists from the tabs you pick |
| Playlist link or ID | A playlist item, plus its videos in order |
| Country codes (needs a key) | YouTube's official most-popular chart for each country, with rank |

#### Data per video

- **Basics:** title, URL, full description, links found in the description, hashtags, tags, category, duration, and publish and upload dates.
- **Stats:** exact view count, like count and comment count.
- **Channel:** ID, name, @handle, URL, verified or artist badge, subscriber count and avatar.
- **Chapters:** start time and title for each chapter.
- **Captions:** which caption languages the video has, including auto-generated ones. This is the list of languages, not the caption text.
- **Related videos:** about 20 related videos with title, channel, views and duration.
- **Status:** live, upcoming and Shorts flags, age restriction, family-safe, unlisted, and the number of countries where the video is available.
- **Images:** thumbnail URLs in every size.
- **With your API key:** comments (author, text, likes, date, replies), definition (HD/SD), license, embeddable, made-for-kids, topic categories, region restrictions, and live viewers and start/end times.

#### Data per channel

Subscriber count, total views, exact video count, joined date, country, description, links (Instagram, X, websites and so on), avatar, banner, verified badge, keywords and the list of available tabs. With a key you also get the uploads playlist ID, topic categories and made-for-kids.

#### Key or no key

| | No key | Your own API key |
|---|---|---|
| Video detail (views, likes, tags, chapters, related videos) | Yes | Yes, plus extra fields |
| Channel profile | Yes | Yes |
| Videos per channel tab | First page (about 30 videos, 48 shorts, 30 streams, 30 playlists) | All of them, up to your limit |
| Videos per playlist | First 100 | All of them, up to your limit |
| Comments and replies | No | Yes |
| Most-popular charts by country | No | Yes |

##### How to get a free API key (about 2 minutes)

1. Open the [Google Cloud Console](https://console.cloud.google.com/) and create a project.
2. Go to **APIs & Services > Library**, search for **YouTube Data API v3** and click **Enable**.
3. Go to **APIs & Services > Credentials > Create credentials > API key**, and copy the key.
4. Paste it into the **Your YouTube Data API key** field. It is stored encrypted.

Every Google project gets **10,000 free quota units a day**. This actor's calls cost 1 unit each. For example, 50 videos' statistics cost 1 unit, 100 comments cost 1 unit, and 50 playlist videos cost 1 unit. A normal run uses a few dozen units. If the quota runs out, the actor keeps going with key-free data and logs a warning.

#### What this actor does not do

- **No transcripts or caption text.** YouTube's `robots.txt` disallows the caption endpoint, and the official API only lets a video's owner download captions. You do get the list of caption languages.
- **No keyword search here.** Use the separate **YouTube Search Scraper**.
- **No video downloads.** You get metadata, thumbnails and links, not video files.
- Without a key, channel tabs and playlists stop after the first page. YouTube loads more through an internal API that `robots.txt` disallows for all crawlers, so this actor never calls it.

#### Input example

```json
{
  "targets": ["@NASA", "https://youtu.be/dQw4w9WgXcQ", "https://www.youtube.com/playlist?list=PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI"],
  "channelTabs": ["videos", "shorts", "streams", "playlists"],
  "maxVideosPerTab": 30,
  "scrapeVideoDetails": true,
  "youtubeApiKey": "AIza...optional",
  "maxCommentsPerVideo": 100,
  "maxRepliesPerComment": 10,
  "trendingRegions": ["US", "ID"]
}
```

#### Output example (video, shortened)

```json
{
  "type": "video",
  "video_id": "dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
  "view_count": 1838391725,
  "like_count": 19510466,
  "comment_count": 2400000,
  "duration_text": "3:33",
  "published_at": "2009-10-24T23:57:33-07:00",
  "category": "Music",
  "channel_name": "Rick Astley",
  "channel_handle": "@RickAstleyYT",
  "channel_verified": true,
  "hashtags": ["#OfficialMusicVideo", "#NeverGonnaGiveYouUp"],
  "caption_languages": [{"language_code": "en", "name": "English", "auto_generated": false}],
  "related_videos": [{"video_id": "yPYZpwSpKmA", "title": "Rick Astley - Together Forever", "view_count": 208000000}],
  "data_sources": ["watch_page"]
}
```

Every item has a `type` field (`video`, `channel` or `playlist`) and a `data_sources` list that shows where each item's data came from. The dataset has ready-made views for Videos, Channels, Playlists and Comments.

#### Tips

- If you only need channel and listing data, turn off **Open every video for full detail**. Runs are much faster, but you get card-level fields only (views rounded, like "75M").
- If YouTube starts asking runs to "confirm you're not a bot", set a residential proxy. Most runs don't need a proxy.

#### Pricing

**$1.5 per 1,000 results.** One result is one video, channel or playlist item. Comments are nested inside their video and don't count as separate results.

# Actor input Schema

## `targets` (type: `array`):

Any mix of YouTube links or IDs, detected automatically: video links (watch, youtu.be, /shorts/, /live/), 11-character video IDs, channel links (/@handle, /channel/UC..., /c/..., /user/...), bare @handles, channel IDs (UC...), and playlist links or IDs (PL...).

## `channelTabs` (type: `array`):

Which channel tabs to scrape for every channel target. Without an API key each tab returns its first page (about 30 videos, 48 shorts, 30 streams or 30 playlists).

## `maxVideosPerTab` (type: `integer`):

Upper limit per channel tab. Without an API key the first page is the ceiling; with your own key the actor paginates up to this number.

## `includeChannelAbout` (type: `boolean`):

Save one channel item per channel: subscribers, total views, video count, joined date, country, links, description, avatar, banner and verified badge.

## `maxPlaylistVideos` (type: `integer`):

Without an API key the playlist page lists its first 100 videos; with your own key the actor paginates up to this number.

## `scrapeVideoDetails` (type: `boolean`):

Open the watch page of every listed video: exact views and likes, full description and links, tags, category, publish date, chapters, caption languages, channel info and related videos. Turn off for faster, card-level results. Single video targets are always opened.

## `includeRelatedVideos` (type: `boolean`):

Add the ~20 related videos shown next to each video (title, channel, views, duration).

## `youtubeApiKey` (type: `string`):

Your own free key for the official YouTube Data API v3 (Google Cloud Console > APIs & Services > enable 'YouTube Data API v3' > Credentials > Create API key). It unlocks comments with replies, every video of a channel tab or playlist, exact statistics and most-popular charts. Most calls cost 1 quota unit of your 10,000 free daily units. Stored encrypted.

## `maxCommentsPerVideo` (type: `integer`):

Top-level comments to save inside each video item (author, text, likes, date). 0 = no comments. 1 quota unit per 100 comments.

## `maxRepliesPerComment` (type: `integer`):

Replies to keep under each comment. Up to 5 come free with the comment; more cost 1 quota unit per 100 replies. 0 = no replies.

## `commentsOrder` (type: `string`):

Order of top-level comments: YouTube's top comments or newest first.

## `trendingRegions` (type: `array`):

Two-letter country codes (US, ID, GB, IN, ...). Saves YouTube's official most-popular videos for each region, with rank. YouTube retired the Trending page in 2025; this chart is its API counterpart.

## `trendingCategoryId` (type: `string`):

Optional video category ID for the chart, e.g. 10 = Music, 20 = Gaming, 17 = Sports, 25 = News & Politics, 24 = Entertainment.

## `maxTrendingPerRegion` (type: `integer`):

How many chart videos to save per country (up to 200).

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

Optional. Not needed in most runs. If YouTube starts asking to 'confirm you're not a bot', switch to a residential proxy.

## Actor input object example

```json
{
  "targets": [
    "https://www.youtube.com/@NASA",
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "channelTabs": [
    "videos",
    "shorts"
  ],
  "maxVideosPerTab": 30,
  "includeChannelAbout": true,
  "maxPlaylistVideos": 100,
  "scrapeVideoDetails": true,
  "includeRelatedVideos": true,
  "maxCommentsPerVideo": 0,
  "maxRepliesPerComment": 0,
  "commentsOrder": "relevance",
  "maxTrendingPerRegion": 50
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `runSummary` (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 = {
    "targets": [
        "https://www.youtube.com/@NASA",
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("amethys/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 = { "targets": [
        "https://www.youtube.com/@NASA",
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("amethys/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 '{
  "targets": [
    "https://www.youtube.com/@NASA",
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ]
}' |
apify call amethys/youtube-scraper --silent --output-dataset

```

## MCP server setup

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