# ⚡ Fast YouTube Scraper & Video Data Extractor (`alabahri/fast-youtube-scraper`) Actor

Extract YouTube search results, channels, views, duration, upload dates, and high-res thumbnails 10x faster using direct JSON streaming without browser bloat.

- **URL**: https://apify.com/alabahri/fast-youtube-scraper.md
- **Developed by:** [Ala Bahri](https://apify.com/alabahri) (community)
- **Categories:** Videos, Social media
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.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/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

## ⚡ Fast YouTube Scraper & Video Data Extractor

> High-speed, lightweight YouTube crawler extracting video search results, channel metrics, duration, view counts, and high-resolution thumbnails **10x faster** than traditional headless browser scrapers.

***

### 🚀 Why Use Fast YouTube Scraper?

Most YouTube scrapers on the market launch full headless Chrome instances, consuming huge amounts of RAM, timing out on long batches, and charging you high prices for compute.

**Fast YouTube Scraper** streams results directly from YouTube's internal JSON endpoints using optimized HTTP protocols.

| Feature | Legacy Scrapers (e.g. Streamers) | ⚡ Fast YouTube Scraper |
| :--- | :--- | :--- |
| **Execution Architecture** | Heavy Headless Chrome | **Lightweight Direct JSON Stream** |
| **Crawl Speed (20 Videos)** | ~45–90 seconds | **< 2 seconds (10x faster)** |
| **Compute Consumption** | High (~0.12 CUs / run) | **Minimal (~0.005 CUs / run)** |
| **Price per 1,000 Videos** | $4.00 / 1,000 | **$2.00 / 1,000 (50% cheaper)** |
| **Numeric Sorting Fields** | ❌ None (raw strings only) | **✅ Clean integers (`durationSeconds`, `viewCountNumeric`)** |
| **Channel Verification** | ❌ Missing | **✅ `channelVerified: true/false`** |
| **Shorts Detection** | ❌ Manual | **✅ `isShort: true/false`** |

***

### 📥 Input Examples

#### Search by Keywords

```json
{
  "searchKeywords": [
    "AI automation tutorial",
    "web scraping nodejs"
  ],
  "maxResults": 25,
  "maxItems": 50
}
```

#### Direct YouTube URLs

```json
{
  "startUrls": [
    "https://www.youtube.com/results?search_query=lofi+hip+hop"
  ],
  "maxResults": 20
}
```

***

### 📤 Output Dataset Format

Every record contains complete video metadata along with enriched numeric values for seamless database ingestion and sorting:

```json
{
  "id": "hHQlcnubuFI",
  "title": "Learn Web Scraping in 5 Minutes (NO PRIOR KNOWLEDGE)",
  "url": "https://www.youtube.com/watch?v=hHQlcnubuFI",
  "duration": "5:12",
  "durationSeconds": 312,
  "viewCount": "190,836 views",
  "viewCountNumeric": 190836,
  "channelName": "CodeHead",
  "channelUrl": "https://www.youtube.com/@CodeHead",
  "channelVerified": true,
  "date": "8 months ago",
  "thumbnailUrl": "https://i.ytimg.com/vi/hHQlcnubuFI/hqdefault.jpg",
  "isShort": false,
  "searchQuery": "web scraping tutorial",
  "extractedAt": "2026-11-17T00:35:00.000Z"
}
```

***

### 💰 Transparent Pay-Per-Result Pricing

- **$0.002 per video ($2.00 per 1,000 videos)**.
- **No monthly subscription required.**
- **Free $5 monthly credit:** Every new Apify user can extract **up to 2,500 videos completely free** every month!

# Actor input Schema

## `searchKeywords` (type: `array`):

Keywords or search phrases to find videos on YouTube.

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

Direct YouTube search result URLs, channel video URLs, or watch URLs.

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

Maximum number of videos to scrape per search query or URL.

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

Total maximum results to output across the entire run.

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

Optional Apify proxy settings to bypass geographic restrictions or high-volume IP blocks.

## Actor input object example

```json
{
  "searchKeywords": [
    "web scraping tutorial",
    "lofi hip hop"
  ],
  "startUrls": [],
  "maxResults": 10,
  "maxItems": 20
}
```

# Actor output Schema

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

Full dataset of extracted YouTube videos with titles, metrics, channel info, and thumbnails.

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

Tabular view of the extracted YouTube videos.

# 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 = {
    "searchKeywords": [
        "web scraping tutorial",
        "lofi hip hop"
    ],
    "startUrls": [],
    "maxResults": 10,
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("alabahri/fast-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 = {
    "searchKeywords": [
        "web scraping tutorial",
        "lofi hip hop",
    ],
    "startUrls": [],
    "maxResults": 10,
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("alabahri/fast-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 '{
  "searchKeywords": [
    "web scraping tutorial",
    "lofi hip hop"
  ],
  "startUrls": [],
  "maxResults": 10,
  "maxItems": 20
}' |
apify call alabahri/fast-youtube-scraper --silent --output-dataset

```

## MCP server setup

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