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

YouTube video scraper for Apify — get YouTube video metadata (title, channel, views, duration, description, likes, thumbnails) from watch URLs, Shorts, or IDs. Bulk Dataset export. Not a video downloader.

- **URL**: https://apify.com/scrapemamba/youtube-video-scraper.md
- **Developed by:** [Scrape Mamba](https://apify.com/scrapemamba) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $0.90 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 Video Scraper — Get Video Metadata at Scale

Turn YouTube watch URLs, Shorts links, or video IDs into clean, exportable metadata — titles, channels, views, duration, descriptions, likes, and thumbnails — ready for analysis, CRM, or warehouse loads.

**[Run YouTube Video Scraper on Apify](https://apify.com/scrapemamba/youtube-video-scraper)** · Built by **ScrapeMamba** · Metadata only (not a video downloader)

***

### Why this Actor?

Most teams already have video IDs and need reliable enrichment: pass a list, get structured Dataset rows with a stable `videoId` join key, and move on.

- Accepts watch URLs, Shorts, `youtu.be`, and bare 11-character IDs
- Deduplicates IDs before fetching
- Isolates failures as `error` rows so one bad ID does not kill the run
- Built for bulk ID lists
- Fits cleanly next to Search, Channel Videos, Related, and Subtitles Actors in the same suite

***

### Key features

- Bulk **YouTube video metadata** from URLs or IDs
- Flat fields ready for CSV/Excel plus a full `raw` payload for deeper attributes
- Per-item error handling for unavailable or invalid videos
- Works with Shorts and long-form videos
- Programmatic runs via Apify API / Client SDKs

***

### What you can scrape

| Group | Fields |
|---|---|
| Identity | `videoId`, `url`, `isShort` |
| Content | `title`, `description`, `thumbnail`, `length` (seconds), `publishedTime` |
| Channel | `author`, `channelId` |
| Engagement | `views`, `likeCount` |
| Diagnostics | `type` (`video` / `error`), `raw`, `error` |

***

### Use cases

- **Enrich discovery results** — After Search or Channel Videos, hydrate IDs with full metadata
- **Competitor content audits** — Compare titles, lengths, and view counts across a URL list
- **Influencer / lead research** — Score videos before outreach
- **Dataset building** — Produce a clean video dimension table keyed by `videoId`
- **Content research** — Pull descriptions and publish signals for topic analysis

***

### Example output

```json
{
  "type": "video",
  "videoId": "dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up (Official Video)",
  "author": "Rick Astley",
  "channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
  "views": 1600000000,
  "likeCount": 17000000,
  "length": 213,
  "publishedTime": "2009-10-25",
  "description": "The official video for “Never Gonna Give You Up”…",
  "thumbnail": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "isShort": false
}
```

Failed items look like `{ "type": "error", "videoId": "…", "error": "…" }` so ETL can filter and retry.

***

### How to use

1. Open **[YouTube Video Scraper](https://apify.com/scrapemamba/youtube-video-scraper)** on Apify
2. Paste `videoIds` (start with one public video)
3. Start the run → export the Dataset (JSON / CSV / Excel) or pull via API

#### Input example

```json
{
  "videoIds": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "https://www.youtube.com/shorts/abc123xyz01"
  ]
}
```

#### API (Node.js)

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('scrapemamba/youtube-video-scraper').call({
  videoIds: ['https://www.youtube.com/watch?v=dQw4w9WgXcQ'],
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

#### Local run

```bash
cd youtube-video-scraper-js
cp .env.example .env
npm install
## INPUT at storage/key_value_stores/default/INPUT.json
node src/main.js
```

***

### Input parameters

| Parameter | Required | Description |
|---|---|---|
| `videoIds` | Yes | YouTube video URLs or 11-character IDs. Free users are limited to **200** videos per run; paying users are uncapped. |

***

### Output

Each successful row is `type: "video"` with mapped metadata plus a `raw` object for extra attributes. Use mapped columns for BI; keep `raw` when you need fields not yet flattened.

| Field | Meaning |
|---|---|
| `videoId` | Stable 11-character ID (join key) |
| `length` | Duration in seconds |
| `views` / `likeCount` | Engagement signals (nullable when unavailable) |
| `isShort` | Whether the item is treated as a Short |

***

### Why choose this Actor

- **Enrichment-first design** — Built for ID lists, not keyword discovery
- **Suite-ready join keys** — Same `videoId` used by Subtitles, Related, and Search Actors
- **Graceful bulk runs** — Bad IDs become error rows; good IDs still land
- **No media downloads** — Focused on public metadata you can warehouse safely

***

### Pricing

**$0.39 per 1,000 results** on Apify (Dataset rows produced by the run). Free users process at most the first **200** videos per run. Confirm current packaging on the [Store page](https://apify.com/scrapemamba/youtube-video-scraper).

***

### FAQ

#### How do I scrape YouTube video metadata with this Actor?

Pass URLs or IDs in `videoIds`, start the run, and export the Dataset — or call the Actor via Apify API/Client.

#### Does it download videos?

No. Public metadata and thumbnails only.

#### How many videos can I process in one run?

Paying users can pass large lists (IDs are deduped before fetch). Free users are limited to the first **200** videos per run. Split very large catalogs across scheduled runs for clearer monitoring.

#### Can I mix watch URLs and Shorts?

Yes. Both normalize to `videoId`; duplicates collapse to one fetch.

#### Why are some rows `type: "error"`?

Unavailable, private, or invalid IDs are isolated so the rest of the batch continues. Filter and retry selectively.

#### Can I schedule enrichment weekly?

Yes. Save an Actor task (or generate Input dynamically), attach an Apify Schedule, and optionally a webhook into your warehouse.

***

### Related Actors

| Actor | Use it for |
|---|---|
| [YouTube Search Scraper](https://apify.com/scrapemamba/youtube-search-scraper) | Discover IDs by keyword |
| [YouTube Channel Videos Scraper](https://apify.com/scrapemamba/youtube-channel-videos-scraper) | List uploads, then enrich here |
| [YouTube Subtitles Scraper](https://apify.com/scrapemamba/youtube-subtitles-scraper) | Transcripts for the same IDs |
| [YouTube Related Videos Scraper](https://apify.com/scrapemamba/youtube-related-videos-scraper) | Recommendation neighbors |

Use only on **public** video data in line with YouTube’s terms and applicable law.

# Actor input Schema

## `videoIds` (type: `array`):

YouTube video URLs or 11-character video IDs. Free users are limited to 200 videos per run.

## Actor input object example

```json
{
  "videoIds": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ]
}
```

# Actor output Schema

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

Default dataset items produced by this Actor.

# 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 = {
    "videoIds": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ]
};

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

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

```

## MCP server setup

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