# YouTube Scraper (`giiwinthrop/youtube-scraper`) Actor

Scrape YouTube videos, Shorts, channels, playlists and search results. Exact views and likes, comment counts, publish dates, descriptions, hashtags and channel stats. No login, no API key.

- **URL**: https://apify.com/giiwinthrop/youtube-scraper.md
- **Developed by:** [Gii Winthrop](https://apify.com/giiwinthrop) (community)
- **Categories:** Social media, Videos
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

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

Scrape public YouTube data without a login or an API key: **videos, Shorts, channels, playlists and search results**. For each video you get the exact view count and like count, comment count, publish date, full description, hashtags, duration and channel details, plus category and keywords when YouTube provides them. Export to JSON, CSV, Excel, or use the API.

### What can it do?

- **Search YouTube** for any keywords, with YouTube's own filters: sort by relevance, upload date, view count or rating; upload date (last hour to this year); duration (under 4 min, 4–20 min, over 20 min); country.
- **Scrape channels** by URL or handle (`@mkbhd`): the Videos, Shorts or Live tab, newest first, plus one item with channel stats (subscribers, number of videos, description, avatar, banner, verified badge).
- **Scrape playlists**: every video in a public playlist, in order.
- **Scrape single videos and Shorts** from any URL format: `watch?v=`, `youtu.be/`, `/shorts/`, `/live/`, or a bare video ID.
- **Monitor new uploads**: set *Only videos published after* to `7 days` and schedule the Actor. On channels it stops as soon as the videos get older, so a weekly check of a channel costs only a few results.

### Who is it for?

- **Marketers and agencies** tracking competitors' channels, campaign videos and engagement.
- **Brands** monitoring what is published about their products (search by brand or product name).
- **Researchers and analysts** building datasets of videos on a topic, with exact counts and dates.
- **Creators** studying which titles, lengths and topics perform in their niche.
- **Developers** who need YouTube metadata in an app without managing API quotas.

### How to use it

1. Enter one or more **search terms** and/or **YouTube URLs** (channels, playlists, videos, Shorts, search pages).
2. Set **Max results per source** (per search term, channel or playlist).
3. Click **Start**. Results appear in the Output tab as they are scraped.

The input form is prefilled, so the first run works with one click.

#### Input example

```json
{
  "searchQueries": ["espresso machine review"],
  "startUrls": [{ "url": "https://www.youtube.com/@mkbhd" }],
  "maxResults": 10,
  "scrapeVideoDetails": true,
  "sortBy": "relevance",
  "publishedAfter": "30 days"
}
```

#### Main input fields

| Field | What it does |
|---|---|
| `searchQueries` | Search terms. Each term is its own search. |
| `startUrls` | Video, Shorts, channel, playlist or search URLs. Channel handles like `@mkbhd` work too. |
| `maxResults` | Max videos per search term, channel or playlist (default 20). |
| `scrapeVideoDetails` | On (default): opens each video for exact likes, comment count, publish date, full description (and category and keywords when available). Off: faster, only what lists show (title, approximate views, duration, relative date). |
| `includeChannelInfo` | Adds one item per channel URL with the channel's stats. |
| `channelTab` | `videos`, `shorts` or `streams`, for channel URLs that don't name a tab. |
| `publishedAfter` | Date (`2026-11-01`) or period (`7 days`, `3 months`). Older videos are skipped. |
| `sortBy`, `uploadDate`, `duration` | YouTube's search filters (search terms only). |
| `countryCode` | Country for search results (default `US`). |

### Output example

One item per video:

```json
{
  "type": "video",
  "id": "dQw4w9WgXcQ",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
  "description": "The official video for “Never Gonna Give You Up” by Rick Astley. ...",
  "channelName": "Rick Astley",
  "channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
  "channelHandle": "@RickAstleyYT",
  "channelUrl": "https://www.youtube.com/@RickAstleyYT",
  "channelSubscribers": 4560000,
  "channelVerified": true,
  "viewCount": 1843805072,
  "likeCount": 19528672,
  "likeCountApprox": false,
  "commentCount": 2400000,
  "commentCountApprox": true,
  "durationSeconds": 213,
  "durationText": "3:33",
  "publishedAt": "2009-10-24T23:57:33-07:00",
  "category": "Music",
  "keywords": ["rick astley", "Never Gonna Give You Up", "..."],
  "hashtags": ["#RickAstley", "#NeverGonnaGiveYouUp", "#OfficialMusicVideo"],
  "isShort": false,
  "isLive": false,
  "thumbnailUrl": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg",
  "detailsScraped": true,
  "source": { "type": "video", "input": "https://youtu.be/dQw4w9WgXcQ" },
  "scrapedAt": "2026-12-05T01:20:00.000Z"
}
```

Channel items (`"type": "channel"`) have `channelId`, `name`, `handle`, `url`, `description`, `subscriberCount`, `videoCount`, `isVerified`, `keywords`, `avatarUrl`, `bannerUrl` and `rssUrl`.

The Output tab has two ready-made views: **Videos** and **Channels**.

#### About the numbers

- `viewCount` and `likeCount` are exact when details are on (`likeCountApprox: false`). They are empty when the creator hides likes or turns comments off.
- `publishedAt` is the exact time (`2026-10-26T17:33:49-07:00`) when YouTube provides it, otherwise the day (`2026-11-17`). `publishedAtPrecision` says which (`second` or `day`).
- `category` and `keywords` are only included when YouTube sends them to logged-out visitors, which is not every time (often about 1 in 4 videos). They are `null` otherwise.
- The duration of some Shorts found through search isn't shown by YouTube and is left empty.
- `commentCount` is what YouTube shows on the page, which is rounded for large numbers (`2.4M`). `commentCountApprox: true` tells you when that is the case.
- `channelSubscribers` / `subscriberCount` are rounded by YouTube itself (`4.56M`).
- With details off, views come from lists and may be rounded (`viewCountApprox`), and the date is an estimate from "2 weeks ago" (`publishedAtEstimate`).

### Pricing

Pay per result: **$2.00 per 1,000 results** ($0.002 per video or channel item), plus a tiny Apify start fee per run. The price is the same with details on or off.

You only pay for results. Inputs that fail (a deleted video, a wrong URL) produce a free `"type": "error"` item explaining what went wrong, so you can see what happened without paying for it.

You can cap the cost of any run with Apify's *Maximum cost per run* setting. The Actor stops cleanly when the cap is reached.

Apify's free plan includes monthly credit, enough to try the Actor on a few hundred videos.

### FAQ

**Do I need a YouTube account or an API key?**
No. The Actor reads public pages the same way a logged-out visitor sees them.

**Does it scrape comments or transcripts?**
Not at the moment. You get the comment *count*, not the comments themselves, and no subtitles or transcripts.

**Does it collect personal data?**
It collects public video and channel metadata. It does not collect viewers' or commenters' profiles. Channel descriptions are saved as written by the channel owner, which sometimes includes a business contact.

**Why are some videos missing details?**
Private, deleted, members-only and some age-restricted videos don't show their details to logged-out visitors. If a listed video can't be opened, the Actor saves what the list showed (`detailsScraped: false`) and adds `detailsError`.

**How many videos can I get from a channel or search?**
Channels and playlists: all their public videos (set `maxResults` high). Searches: YouTube stops returning results after several hundred per query, so split broad topics into several search terms.

**Is it legal to scrape YouTube?**
This Actor only reads publicly available data, without logging in. YouTube's Terms of Service restrict automated access, and laws differ by country, so check that your use case is lawful, especially if you plan to store or republish data. If in doubt, ask a lawyer.

### Limits

- Public, logged-out data only. No private, unlisted-by-link discovery, members-only or login-gated content.
- Comment counts and subscriber counts are YouTube's rounded figures.
- YouTube changes its pages from time to time. When that breaks something, the Actor gets fixed. Please report problems in the Issues tab, ideally with the input you used.

### Support

Found a bug or need a field that isn't here? Open an issue on the Actor's Issues tab. Requests are read and answered.

# Actor input Schema

## `searchQueries` (type: `array`):

Search YouTube for these terms, exactly like the search box. Each term is a separate search and gets up to 'Max results per source' videos.

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

Videos, Shorts, channels, playlists or search result pages. Examples: https://www.youtube.com/watch?v=dQw4w9WgXcQ, https://www.youtube.com/@mkbhd, https://www.youtube.com/@mkbhd/shorts, https://www.youtube.com/playlist?list=..., https://youtu.be/... Channel handles like @mkbhd work too.

## `maxResults` (type: `integer`):

Maximum number of videos per search term, channel or playlist. A single video URL always gives one result.

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

Open each video's page to get exact view and like counts, comment count, publish date, full description and hashtags, plus category and keywords when YouTube provides them. Turn off for a faster run with only the data shown in lists (title, approximate views, duration, relative date). The price per result is the same.

## `includeChannelInfo` (type: `boolean`):

For each channel URL, also save one item with the channel's name, handle, subscriber count, video count, description and avatar. This counts as one result.

## `channelTab` (type: `string`):

Which list to scrape from channel URLs that don't name a tab. A URL ending in /videos, /shorts or /streams overrides this.

## `publishedAfter` (type: `string`):

Skip videos published before this date. Use a date (2026-11-01) or a relative period (7 days, 2 weeks, 3 months, 1 year). On channels, scraping stops once the videos get older than this.

## `sortBy` (type: `string`):

Order of search results. Applies to search terms only.

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

YouTube's own upload-date filter for search terms.

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

YouTube's own duration filter for search terms: short is under 4 minutes, medium 4 to 20 minutes, long over 20 minutes.

## `countryCode` (type: `string`):

Two-letter country code (US, GB, CA, DE...). Changes which search results YouTube shows. Texts are always requested in English.

## `maxConcurrency` (type: `integer`):

How many pages to load in parallel. Higher is faster but more likely to be rate-limited by YouTube.

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

Proxy servers to use. Apify's default (datacenter) proxy works for most runs.

## `debugSaveHtml` (type: `boolean`):

For troubleshooting only: saves up to 3 video pages with incomplete data to the run's key-value store.

## Actor input object example

```json
{
  "searchQueries": [
    "espresso machine review"
  ],
  "startUrls": [
    {
      "url": "https://www.youtube.com/@mkbhd"
    }
  ],
  "maxResults": 10,
  "scrapeVideoDetails": true,
  "includeChannelInfo": true,
  "channelTab": "videos",
  "sortBy": "relevance",
  "uploadDate": "any",
  "duration": "any",
  "countryCode": "US",
  "maxConcurrency": 5,
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "debugSaveHtml": false
}
```

# Actor output Schema

## `results` (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 = {
    "searchQueries": [
        "espresso machine review"
    ],
    "startUrls": [
        {
            "url": "https://www.youtube.com/@mkbhd"
        }
    ],
    "maxResults": 10,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("giiwinthrop/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 = {
    "searchQueries": ["espresso machine review"],
    "startUrls": [{ "url": "https://www.youtube.com/@mkbhd" }],
    "maxResults": 10,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("giiwinthrop/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 '{
  "searchQueries": [
    "espresso machine review"
  ],
  "startUrls": [
    {
      "url": "https://www.youtube.com/@mkbhd"
    }
  ],
  "maxResults": 10,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call giiwinthrop/youtube-scraper --silent --output-dataset

```

## MCP server setup

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