# SocialGrid — YouTube Scraper (`fulinlabs/socialgrid-youtube-scraper`) Actor

Unified-schema YouTube profile, video, comment, search, and trending data. Thin wrapper around @socialgrid/scraper-youtube — see PLAN.md in the SocialGrid monorepo for the portability rule this actor follows.

- **URL**: https://apify.com/fulinlabs/socialgrid-youtube-scraper.md
- **Developed by:** [Giovanni](https://apify.com/fulinlabs) (community)
- **Categories:** Social media
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.70 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use 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

## SocialGrid — YouTube Scraper

> **Unofficial community Actor.** Not affiliated with, endorsed by, or sponsored by YouTube or Google.

Unified-schema YouTube data: channel profiles, video posts, single-video detail (with transcript), comments, search, and trending — returned as flat, agent-ready JSON, never raw InnerTube blobs.

### Why this vs. a raw-blob scraper

Most YouTube scrapers on the Store hand you exactly what YouTube's internal `youtubei` API returns: deeply nested, engineer-facing JSON full of renderer types, CDN thumbnail forests, and fields that only make sense if you've read Google's internal schema. That's expensive to parse and expensive to feed to an LLM.

This actor normalizes everything into four flat shapes — `Author`, `Post`, `Comment`, `Computed` — shared across SocialGrid's YouTube, TikTok, and Instagram scrapers, so downstream code (or an LLM agent) can treat every platform the same way. Fields the platform genuinely doesn't expose are `null`, never `0` or an empty string — so you can tell "no data" apart from "zero engagement."

### What it does

| Mode | Description | Key input |
|---|---|---|
| `profile` | Channel profile: display name, bio, avatar, subscriber/video counts, external links | `handle` |
| `posts` | List a channel's videos (latest or most popular), paginated | `handle`, `sort`, `cursor`, `limit` |
| `post` | Single video detail, optionally with the caption transcript | `videoIdOrUrl`, `transcript` |
| `comments` | A video's comments (top-liked or newest), paginated | `videoIdOrUrl`, `commentSort`, `cursor` |
| `search` | Search videos by keyword, channels, or a hashtag page | `query`, `searchType`, `cursor` |
| `trending` | Trending videos for a region | `region`, `cursor` |
| `full` | Composite: profile + recent posts + computed analytics in one call | `handle`, `limit` |

This is the full surface of the SocialGrid scraper contract (`getProfile`/`getPosts`/`getPost`/`getComments`/`search`/`getTrending`) — YouTube is the only one of the three SocialGrid platform actors where every mode is implemented and live-verified (TikTok and Instagram currently ship a reduced surface — see their own README for why).

**Known limitation:** transcript fetch is best-effort — it depends on YouTube publishing timed-text captions for that video, and returns a clean error (never fake data) when a video has none.

### Example output (`mode: "profile"`)

```json
{
  "success": true,
  "platform": "youtube",
  "mode": "profile",
  "data": {
    "platform": "youtube",
    "id": "UCX6OQ3DkcsbYNE6H8uQQuVA",
    "handle": "@mrbeast",
    "display_name": "MrBeast",
    "bio": "SUBSCRIBE FOR A COOKIE!\n...",
    "avatar_url": "https://yt3.googleusercontent.com/...",
    "verified": false,
    "followers": 508000000,
    "following": null,
    "post_count": 992,
    "total_likes": null,
    "external_links": [
      "https://www.instagram.com/mrbeast/",
      "https://twitter.com/MrBeast",
      "https://facebook.com/mrbeast/"
    ],
    "is_private": false
  }
}
````

`following` and `total_likes` are `null` because YouTube channels don't expose those concepts — that's a real "platform doesn't have this," not a scrape failure.

`mode: "full"` additionally returns `posts[]` (unified `Post` objects) and a `computed` block:

```json
"computed": {
  "engagement_rate": 0.041,
  "posting_cadence_per_week": 1.2,
  "cadence_window_days": 90,
  "median_views": 18500000,
  "top_post_id": "dQw4w9WgXcQ",
  "format_mix": { "video": 0.9, "short": 0.1 }
}
```

### Input

See the Input tab for the full JSON schema. Quick reference:

- `mode` (required): `profile | posts | post | comments | search | trending | full`
- `handle`: channel handle (`@MrBeast`) or full channel URL — required for `profile`/`posts`/`full`
- `videoIdOrUrl`: required for `post`/`comments`
- `query`: required for `search`
- `sort`, `commentSort`, `searchType`, `region`, `cursor`, `limit`, `transcript`: mode-specific options, all documented per-field in the input schema

### Usage

#### Apify CLI

```bash
apify actors call fulinlabs/socialgrid-youtube-scraper \
  --input '{"mode": "profile", "handle": "@mrbeast"}'
```

#### REST API

```bash
curl "https://api.apify.com/v2/acts/fulinlabs~socialgrid-youtube-scraper/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"mode": "full", "handle": "@mrbeast", "limit": 30}'
```

### Pricing

Pay-per-result, benchmarked against comparable Store actors (apidojo's YouTube/YouTube Channel Scraper at $0.50/1,000 videos-or-channels, streamers' YouTube Scraper at $5.00/1,000 videos with event-based pricing, apizy's pay-per-success YouTube Channel Scraper at $0.005/channel). Given this actor's simpler single-profile/single-video results (vs. deep multi-video crawls), proposed pricing:

- `profile` / `post` / `full`: **$1.00 per 1,000 results**
- `posts` / `comments` / `search` / `trending` (list-shaped, one dataset item per video/comment/result): **$0.50 per 1,000 items**

### Reliability

A 6-hour canary schedule re-runs the live test suite against known fixtures (big/mid/small/private/deleted channels) and alerts on failure — see `PLAN.md` in the SocialGrid monorepo for the testing policy this actor is held to.

# Actor input Schema

## `mode` (type: `string`):

Which ScraperModule operation to run.

## `handle` (type: `string`):

e.g. '@MrBeast' or a full channel URL. Required for mode=profile|posts|full.

## `videoIdOrUrl` (type: `string`):

Required for mode=post|comments.

## `query` (type: `string`):

Required for mode=search.

## `sort` (type: `string`):

Video ordering for mode=posts: latest uploads or most popular.

## `commentSort` (type: `string`):

Comment ordering for mode=comments: top-liked or newest first.

## `searchType` (type: `string`):

What to search for with mode=search: videos by keyword, channels, or a hashtag page.

## `region` (type: `string`):

Two-letter country code used for mode=trending, e.g. 'US'.

## `cursor` (type: `string`):

Opaque continuation token from a previous response's next\_cursor, used to fetch the next page.

## `limit` (type: `integer`):

Maximum number of items to return for list-shaped modes (posts, search, full).

## `transcript` (type: `boolean`):

If true, also fetch the video's caption transcript (best-effort — see PLAN.md known limitations).

## Actor input object example

```json
{
  "mode": "profile",
  "sort": "latest",
  "commentSort": "top",
  "searchType": "keyword",
  "region": "US",
  "limit": 30,
  "transcript": false
}
```

# Actor output Schema

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

Dataset items containing the requested YouTube result wrapper, including success state, mode, data, or an error.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("fulinlabs/socialgrid-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("fulinlabs/socialgrid-youtube-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call fulinlabs/socialgrid-youtube-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=fulinlabs/socialgrid-youtube-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "SocialGrid — YouTube Scraper",
        "description": "Unified-schema YouTube profile, video, comment, search, and trending data. Thin wrapper around @socialgrid/scraper-youtube — see PLAN.md in the SocialGrid monorepo for the portability rule this actor follows.",
        "version": "0.1",
        "x-build-id": "oY39venh0uNs1JaQr"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/fulinlabs~socialgrid-youtube-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-fulinlabs-socialgrid-youtube-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/fulinlabs~socialgrid-youtube-scraper/runs": {
            "post": {
                "operationId": "runs-sync-fulinlabs-socialgrid-youtube-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/fulinlabs~socialgrid-youtube-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-fulinlabs-socialgrid-youtube-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "mode"
                ],
                "properties": {
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "profile",
                            "posts",
                            "post",
                            "comments",
                            "search",
                            "trending",
                            "full"
                        ],
                        "type": "string",
                        "description": "Which ScraperModule operation to run.",
                        "default": "profile"
                    },
                    "handle": {
                        "title": "Channel handle or URL",
                        "type": "string",
                        "description": "e.g. '@MrBeast' or a full channel URL. Required for mode=profile|posts|full."
                    },
                    "videoIdOrUrl": {
                        "title": "Video ID or URL",
                        "type": "string",
                        "description": "Required for mode=post|comments."
                    },
                    "query": {
                        "title": "Search query",
                        "type": "string",
                        "description": "Required for mode=search."
                    },
                    "sort": {
                        "title": "Sort (posts)",
                        "enum": [
                            "latest",
                            "popular"
                        ],
                        "type": "string",
                        "description": "Video ordering for mode=posts: latest uploads or most popular.",
                        "default": "latest"
                    },
                    "commentSort": {
                        "title": "Sort (comments)",
                        "enum": [
                            "top",
                            "recent"
                        ],
                        "type": "string",
                        "description": "Comment ordering for mode=comments: top-liked or newest first.",
                        "default": "top"
                    },
                    "searchType": {
                        "title": "Search type",
                        "enum": [
                            "keyword",
                            "users",
                            "hashtag"
                        ],
                        "type": "string",
                        "description": "What to search for with mode=search: videos by keyword, channels, or a hashtag page.",
                        "default": "keyword"
                    },
                    "region": {
                        "title": "Region (trending)",
                        "type": "string",
                        "description": "Two-letter country code used for mode=trending, e.g. 'US'.",
                        "default": "US"
                    },
                    "cursor": {
                        "title": "Pagination cursor",
                        "type": "string",
                        "description": "Opaque continuation token from a previous response's next_cursor, used to fetch the next page."
                    },
                    "limit": {
                        "title": "Max items",
                        "minimum": 1,
                        "maximum": 100,
                        "type": "integer",
                        "description": "Maximum number of items to return for list-shaped modes (posts, search, full).",
                        "default": 30
                    },
                    "transcript": {
                        "title": "Fetch transcript (mode=post)",
                        "type": "boolean",
                        "description": "If true, also fetch the video's caption transcript (best-effort — see PLAN.md known limitations).",
                        "default": false
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
