# Macrocosmos Yt Scraper (`macrocosmos/macrocosmos-yt-scraper`) Actor

Extract YouTube transcripts and metadata at scale. Scrape videos or channels to get full transcript text with timestamps, video metadata, and engagement metrics (views, likes, subscribers). Perfect for content analysis, research, SEO, and AI training datasets.

- **URL**: https://apify.com/macrocosmos/macrocosmos-yt-scraper.md
- **Developed by:** [Macrocosmos](https://apify.com/macrocosmos) (community)
- **Categories:** Agents, Videos, Social media
- **Features:** Limited permissions
- **Stats:** 35 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

$4.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

## YouTube Transcript Scraper

Extract transcripts and metadata from YouTube videos at scale. Scrape individual videos or entire channels with full transcript text, timestamps, and engagement metrics.

### What it does

This actor extracts complete video data including:

- Full transcript with timestamps (when available)
- Video metadata (title, description, duration)
- Engagement metrics (views, likes, subscriber count)
- Channel information

### Input

| Field | Type | Description |
|-------|------|-------------|
| `urls` | array | YouTube video URLs to scrape |
| `channel_url` | string | Channel URL to scrape recent videos from |
| `max_videos` | integer | Max videos per channel (default: 10) |
| `start_date` | string | Filter: videos after this date (YYYY-MM-DD) |
| `end_date` | string | Filter: videos before this date (YYYY-MM-DD) |

### Output

```json
{
  "video_id": "dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up",
  "channel_name": "Rick Astley",
  "upload_date": "2009-10-25T00:00:00+00:00",
  "transcript": [
    {"text": "We're no strangers to love", "start": 18.0, "end": 21.5},
    {"text": "You know the rules and so do I", "start": 21.5, "end": 25.0}
  ],
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "duration_seconds": 212,
  "language": "en",
  "thumbnails": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg",
  "view_count": 1500000000,
  "description": "The official video for Never Gonna Give You Up...",
  "like_count": 15000000,
  "subscriber_count": 3500000
}
```

### Examples

**Scrape specific videos:**

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "https://youtu.be/fJ9rUzIMcZQ"
  ]
}
```

**Scrape recent channel videos:**

```json
{
  "channel_url": "https://www.youtube.com/@Fireship",
  "max_videos": 10,
  "start_date": "2024-01-01"
}
```

### Use cases

- **Content analysis** - Analyze video transcripts for sentiment, topics, keywords
- **Research** - Collect video data for academic or market research
- **SEO** - Extract metadata for competitive analysis
- **Accessibility** - Get transcripts for content repurposing
- **AI training** - Build datasets for machine learning models

### Notes

- Transcripts depend on video having captions (manual or auto-generated)
- Uses residential proxies for reliable extraction
- Respects YouTube's rate limits automatically

# Actor input Schema

## `urls` (type: `array`):

List of YouTube video URLs to scrape transcripts from

## `channel_url` (type: `string`):

YouTube channel URL to scrape recent videos from (alternative to video URLs)

## `max_videos` (type: `integer`):

Maximum number of videos to scrape from a channel

## `start_date` (type: `string`):

Only scrape videos published after this date (YYYY-MM-DD format)

## `end_date` (type: `string`):

Only scrape videos published before this date (YYYY-MM-DD format)

## `language` (type: `string`):

Preferred transcript language code (e.g., 'en', 'uk', 'es', 'de'). If not specified, uses first available transcript.

## `proxy_config` (type: `object`):

Apify Proxy configuration

## Actor input object example

```json
{
  "urls": [],
  "max_videos": 10,
  "proxy_config": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# 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 = {
    "urls": [],
    "max_videos": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("macrocosmos/macrocosmos-yt-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 = {
    "urls": [],
    "max_videos": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("macrocosmos/macrocosmos-yt-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 '{
  "urls": [],
  "max_videos": 10
}' |
apify call macrocosmos/macrocosmos-yt-scraper --silent --output-dataset

```

## MCP server setup

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