# YouTube Scraper – Videos, Channels, Comments & Search (`pear_fight/youtube-scraper`) Actor

Fast YouTube scraper for videos, channels, playlists, comments & search results. Extract views, likes, comment text, subscriber counts, upload dates, durations & video URLs — no API key or login. Export to JSON, CSV or Excel. Pay only per result.

- **URL**: https://apify.com/pear\_fight/youtube-scraper.md
- **Developed by:** [Harald](https://apify.com/pear_fight) (community)
- **Categories:** Social media, Videos
- **Stats:** 82 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.13 / 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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## YouTube Scraper – Search Videos by Keyword (No API Key)

Fast **YouTube scraper** that extracts video search results for any keyword — **no API key, no login, no quotas**. Enter keywords, get structured video data (title, channel, views, duration, publish date, and URL) exported to **JSON, CSV, or Excel**. Pay only per result.

Ideal for content research, trend tracking, competitor and keyword analysis, and building YouTube datasets for analytics or machine learning.

### Why use this YouTube Scraper?

- ⚡ **Fast** — collect hundreds of video results per keyword in seconds.
- 🔑 **No YouTube API key required** — no Google Cloud setup, no API quotas.
- 🔍 **Keyword search at scale** — search many keywords in a single run.
- 💾 **Export anywhere** — JSON, CSV, Excel, or via the Apify API.
- 💸 **Pay per result** — usage-based pricing, no subscription.

### What data does it extract?

For each video result, the scraper returns:

| Field | Description |
|-------|-------------|
| `title` | Video title |
| `url` | Full YouTube video URL |
| `videoId` | YouTube video ID |
| `channelName` | Name of the channel |
| `viewCount` | View count as a number (may be null for live streams) |
| `viewCountText` | View count as displayed (e.g. "55,958,898 views") |
| `duration` | Video length (e.g. "6:10:58") |
| `publishedTime` | Relative publish time (e.g. "4 years ago") |
| `description` | Video description snippet |
| `searchKeyword` | The keyword this result came from |
| `scrapedAt` | Timestamp of the scrape (UTC) |

### How to use it

1. Click **Try for free**.
2. Add one or more **search keywords** (each is searched separately).
3. Set **Max results per keyword** (1–1000, default 50).
4. Click **Start** and download results as JSON, CSV, or Excel.

No coding required. Also runnable via the Apify API or on a schedule.

### Input

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `searchKeywords` | array of strings | Yes | Keywords/phrases to search YouTube for. Each is searched separately. |
| `maxResults` | integer | No | Max video results per keyword (1–1000). Default: 50. |

#### Example input

````json
{
  "searchKeywords": ["lofi hip hop", "react tutorial"],
    "maxResults": 50
    }
    ```

    ## Example output

    ```json
    {
      "title": "Best of lofi hip hop 2021 [beats to relax/study to]",
        "url": "https://www.youtube.com/watch?v=n61ULEU7CO0",
          "videoId": "n61ULEU7CO0",
            "channelName": "Lofi Girl",
              "viewCount": 55958898,
                "viewCountText": "55,958,898 views",
                  "duration": "6:10:58",
                    "publishedTime": "4 years ago",
                      "searchKeyword": "lofi hip hop",
                        "scrapedAt": "2026-07-16 21:24:25 UTC"
                        }
                        ```

                        ## Common use cases

                        - **Content & SEO research** — find top videos ranking for any keyword.
                        - **Trend tracking** — monitor which videos surface for trending terms.
                        - **Competitor analysis** — see who ranks for your target keywords.
                        - **Dataset building** — collect video metadata for analytics or ML.

                        ## Pricing

                        Pay-per-result — you only pay for the data you collect. See the **Pricing** tab for current rates.

                        ## FAQ

                        **Do I need a YouTube or Google API key?** No — it works without any API key or login.

                        **What formats can I export?** JSON, CSV, Excel, and direct API access.

                        **Can it scrape a specific channel, playlist, or video's comments?** This Actor searches by keyword and returns video results. It does not currently take channel/playlist/video URLs as input.

                        **Is scraping YouTube legal?** It collects publicly available data. You're responsible for ensuring your use complies with YouTube's Terms of Service and applicable laws.

                        ## Support

                        Found a bug or want a feature? Open an issue on the **Issues** tab.

# Actor input Schema

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

Keywords or phrases to search YouTube for. Each keyword is searched separately.
## `maxResults` (type: `integer`):

Maximum number of video results to collect for each search keyword.

## Actor input object example

```json
{
  "searchKeywords": [
    "lofi hip hop",
    "react tutorial"
  ],
  "maxResults": 50
}
````

# 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": [
        "lofi hip hop"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("pear_fight/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": ["lofi hip hop"] }

# Run the Actor and wait for it to finish
run = client.actor("pear_fight/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": [
    "lofi hip hop"
  ]
}' |
apify call pear_fight/youtube-scraper --silent --output-dataset

```

## MCP server setup

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