# YouTube Scraper & Transcript Extractor (`autoclawai/my-actor`) Actor

Extract clean YouTube video metadata, views, duration, and AI-ready transcripts (manual & auto-generated) without login or headless browsers. Fast, proxy-ready, and built for n8n, Make, Zapier, and AI agents.

- **URL**: https://apify.com/autoclawai/my-actor.md
- **Developed by:** [Sonic Dash](https://apify.com/autoclawai) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $5.00 / 1,000 scraped youtube videos

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 Scraper & Transcript Extractor

An Apify Actor that collects normalized metadata and available captions from YouTube videos without signing in or launching a headless browser. It uses YouTube's public InnerTube player responses first and the watch-page HTML as a complementary fallback. Requests can use the Apify proxy pool, and each video is isolated so restrictions or outages do not stop the rest of a run.

### Features

- Accepts standard watch URLs, `youtu.be` links, Shorts, embed URLs, and raw 11-character video IDs.
- Strips irrelevant URL parameters and de-duplicates videos.
- Tries WEB, Android, and TV InnerTube contexts and then parses watch-page player/data JSON.
- Resolves caption tracks from player data and watch HTML; tries JSON3, XML timed-text formats, then the InnerTube `get_transcript` endpoint.
- Prefers manual captions over auto-generated captions and cleans captions into one paragraph.
- Extracts available description hashtags, likes, comments, subscriber counts, and social links without a separate channel crawl.
- Emits one flat dataset record for each valid input, including sparse records when YouTube blocks metadata access.
- Uses proxy support and bounded concurrency; no login or browser required.

### Input

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=JSrGw5HftbY"
  ],
  "includeTranscript": true,
  "maxRequestsPerCrawl": 50,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

The input form is prefilled with `https://www.youtube.com/watch?v=JSrGw5HftbY`. If the Actor is run locally without an input record, it uses that sample URL. An explicitly supplied empty or invalid input exits with code 1. `includeTranscript` defaults to `true`; `maxRequestsPerCrawl` defaults to `50`. `proxyConfiguration` is optional and follows Apify's proxy configuration format. Invalid IDs are logged and skipped; a run with no valid IDs exits with code 1.

### Output

One record is pushed to the default dataset for each video:

```json
{
  "videoId": "JSrGw5HftbY",
  "url": "https://www.youtube.com/watch?v=JSrGw5HftbY",
  "title": "l'Morphine - Ay9ona",
  "channelName": "2020 SQUAD",
  "channelId": "UCxxxxxxxxxxxxxxxxxxxxxx",
  "viewsCount": 962644,
  "durationSeconds": 258,
  "publishedAt": "2016-04-30T10:55:28-07:00",
  "isLive": false,
  "keywords": ["example", "music"],
  "description": "A clean description without markup or excess whitespace.",
  "likesCount": 13587,
  "socialMediaLinks": null,
  "commentsCount": 628,
  "channelLocation": null,
  "totalVideos": null,
  "channelUrl": "https://www.youtube.com/channel/UCxxxxxxxxxxxxxxxxxxxxxx",
  "videoViewCount": 962644,
  "totalViews": null,
  "subscriberCount": 106,
  "hashtags": [],
  "thumbnails": ["https://i.ytimg.com/vi/JSrGw5HftbY/hqdefault.jpg"],
  "aiVideoDescription": null,
  "aiVideoSummary": null,
  "hasTranscript": true,
  "transcriptSource": "auto-generated",
  "transcriptLength": 19,
  "transcriptText": "A clean transcript.",
  "extractionMethod": "innertube-web+watch-player+watch-page"
}
```

Unavailable text fields are empty strings, numeric metadata defaults to `0`, and `publishedAt`, `transcriptSource`, and `transcriptText` are `null` when unavailable. `likesCount`, `socialMediaLinks`, `commentsCount`, `channelLocation`, channel totals, and AI-generated descriptions/summaries are `null` until a source is available; the Actor does not invent these values or call an AI service. Thumbnails and hashtags are populated from available video data. Duration and publication date use player data first and watch-page/HTML metadata as fallbacks. Transcript length is the number of characters in the cleaned transcript. `extractionMethod` identifies the successful metadata paths.

The dataset overview includes the requested channel, engagement, video, transcript, duration, release-date, hashtag, thumbnail, and AI-description/summary columns. Fields not currently provided by YouTube's public player/watch-page data remain `null`.

### Automation and AI integrations

Use the Apify API to start a run with the JSON input above, then read the default dataset as JSON. In n8n, Make, or Zapier, connect an Apify Actor task/run step to a dataset-items step and map the flat fields into subsequent actions. For AI/MCP workflows, dataset JSON can be passed directly as structured video metadata and transcript context.

### Proxy and reliability notes

The Actor supports the standard Apify `proxyConfiguration` object. Apify Proxy is recommended for larger or geographically varied runs; use residential proxy groups when your account has access and the target content requires them. Proxy access does not bypass login, membership, age, privacy, copyright, or regional restrictions. Restricted and deleted videos may produce sparse records with a warning. YouTube changes its undocumented endpoints periodically, so extraction paths are intentionally redundant but cannot guarantee data availability for every video.

### Local development

Requires Node.js 20 or newer.

```sh
npm install
npm test
npm run build
npm start
```

To run locally with the Apify CLI, build the Actor and provide input through the CLI's input workflow. Local calls do not use Apify Proxy unless valid proxy configuration and credentials are available.

# Actor input Schema

## `videoUrls` (type: `array`):

YouTube watch, youtu.be, shorts, embed URLs, or raw 11-character video IDs.

## `includeTranscript` (type: `boolean`):

Fetch and clean captions when available.

## `maxRequestsPerCrawl` (type: `integer`):

Maximum number of valid video IDs to process.

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

Apify proxy configuration. Residential proxies can improve reliability for geographically restricted or throttled requests.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=JSrGw5HftbY"
  ],
  "includeTranscript": true,
  "maxRequestsPerCrawl": 50
}
```

# Actor output Schema

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

Video records extracted by the 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("autoclawai/my-actor").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("autoclawai/my-actor").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 '{}' |
apify call autoclawai/my-actor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,autoclawai/my-actor"
        }
    }
}
```

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/RccsRhHbQ18nJe2EL/builds/rS4dccLoZoXjikH9N/openapi.json
