# YouTube Scraper: Videos, Shorts, Comments & Transcripts (`lofomachines/youtube-scraper`) Actor

Scrape YouTube videos, Shorts, comments, replies, Community posts and available automatic transcripts. \[0.35$ per 1,000 video results]. Platform usage included. Export CSV, Excel or JSON without code.

- **URL**: https://apify.com/lofomachines/youtube-scraper.md
- **Developed by:** [Lofomachines](https://apify.com/lofomachines) (community)
- **Features:** Limited permissions, Multi-tenant, Server interface
- **Stats:** 2 total users, 2 monthly users, 75.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

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

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: Videos, Shorts, Comments & Transcripts

**Starter / Bronze: $0.35 per 1,000 results + $0.003 per start at the default 512 MB. Platform usage included.** See [pricing and examples](#how-much-does-youtube-scraping-cost) for the exact result unit and total charges.

Turn public YouTube content into useful research data. **Find videos by keyword, collect a channel’s videos and Shorts, export comments and replies, and retrieve available automatic or manual transcripts** from one simple form. Add Community posts and channel profiles when you need a broader picture of a creator or brand.

Paste YouTube links or enter search phrases, choose what to collect, and start your run. Download the results as JSON, CSV or Excel, or connect them to your existing Apify workflows. You do not need a YouTube API key or a YouTube login.

### What can this YouTube scraper collect?

| What you need | What you receive |
| --- | --- |
| YouTube keyword research | Video results with titles, URLs, creators, available view counts, duration and publication labels |
| A channel’s video catalogue | Public videos and Shorts, with optional live-stream listings; each section is collected separately |
| Rich video information | Available descriptions, tags, categories, engagement counts, dates, chapters and other public metadata |
| YouTube comments and replies | Video, Short and Community-post comments with available text, images, author information, likes, reply relationships and the original publication label |
| YouTube transcripts | Available manual and automatically generated captions, readable text, language and timestamped segments |
| Community posts | Available post text, images, attachments, polls and public engagement information |
| Channel profiles | Available channel descriptions, subscriber labels, links, imagery and other public profile information |
| Playlist videos | Public videos returned by a playlist, subject to your chosen limit |

Unavailable text, dates and counts remain empty. Video-type flags can be inferred from the source section, badges or URLs; a false flag can mean the corresponding indicator was not exposed. The collection report explains sources that reached a limit, stopped early, were unavailable or encountered an error.

### Start in three steps

For a quick first run, choose **Restore example input**: the ready-to-run `coffee` keyword search returns up to **10 videos**, with comments and transcripts off. Replace or clear the example keyword before adding your own sources.

1. **Choose your sources.** Paste video, Short, channel or playlist URLs under **YouTube links**, or add phrases under **Search keywords**. You can use both in the same run.
2. **Choose what to collect.** Select Videos, Shorts, Live streams and/or Community posts for channels, and choose a video limit. Switch on comments or available transcripts when you need them. Replies and channel profiles are included automatically where available.
3. **Run and download.** Open the result you need in the Output tab. Videos, Comments, Community posts and Channels are separate datasets. Read the Collection summary before treating a run as complete.

The Run page’s main Export button exports the Videos dataset. For comments, posts or channel profiles, open the relevant dataset in Output or select it in Storage, then choose your export format. JSON retains nested transcript segments and attachments most naturally.

The form has three main sections: **Choose your sources**, **Choose what to collect**, and **Add comments or transcripts**. **Optional preferences** contains richer video information, preferred caption languages, Community post limits and the search upload period. Search country and search language are selected by name next to your keywords, together with the search result order. Caption languages are selected separately by name. Connections, parallel work, recovery attempts and time limits are managed automatically.

### Choose the right collection settings

| Your goal | Suggested settings |
| --- | --- |
| Build a list of 1,000 videos about a topic | Search keywords; basic video details; maximum videos `1000`; transcripts and comments off |
| Collect all discoverable uploads from a channel | Channel URL; Videos and Shorts; maximum videos `0` |
| Analyze the latest 1,000 comments on a video | Video URL; Collect comments too; maximum comments `1000`; newest order applied automatically |
| Prepare video text for research or an AI workflow | Video or channel URLs; Collect available transcripts; choose preferred languages by name |
| Research video metadata and audience feedback together | Full descriptions and video metadata; collect comments; add transcripts if needed |
| Monitor creator announcements | Channel URL; Community posts; choose a post limit |

**Limits apply per source.** The video limit applies separately to each keyword, playlist and selected channel video section. A channel with Videos and Shorts selected can therefore return up to twice that limit. Community posts have their own limit. The comment limit is per video or Community post and includes replies; a reply also counts toward that total.

`0` means no item limit for the relevant setting. Collection stops after one hour, or earlier when YouTube stops exposing results or the platform run ends. Search is a ranked feed: even with no item limit, it is not an exhaustive inventory of every video matching a phrase. The default **Expanded discovery** automatically combines additional result streams and narrower upload-period slices for the same keyword to discover more unique videos. It preserves your chosen upload-period restriction, deduplicates videos and applies one shared limit per keyword. Its output is not a single global ranking.

### Search YouTube by country, language and result order

Find content for a local market: choose **Italy** and **Italian**, or another country/language combination, directly in the form. These settings influence YouTube results and displayed metadata. They are not strict filters for creator nationality or the language spoken in a video, and they do not change proxy geography. Some localized metrics may be unavailable numerically; the original displayed text is retained when available.

| Search result order | What you get |
| --- | --- |
| Expanded discovery (default) | The existing broad collection across rankings and narrower date windows, deduplicated per keyword. |
| Relevance | One YouTube relevance stream, preserving its order across pages. |
| Popular | One YouTube popularity stream. Popularity is YouTube's ranking, not a strict descending view-count sort. |
| Newest (within collected results) | Collect up to your video limit from relevance search, then sort that sample by displayed publication age. Unknown ages go last; ties retain discovery order. |

**Newest is a sample sort, not a global newest-video search.** YouTube's current search client does not provide a reliable native upload-date ranking. Use the upload-period filter (Today, This week, This month or This year) to narrow your search. Newest requires a limit between 1 and 10,000; the limit applies before sorting. Displayed ages are approximate and are not converted into invented exact publication dates. Keyword sorting does not reorder channel or playlist URLs. Existing saved tasks that omit these options keep expanded discovery, United States and English.

#### Find recent Italian videos

```json
{
  "searchQueries": ["recensione macchina caffè"],
  "country": "IT",
  "language": "it",
  "searchSort": "newest",
  "searchDate": "week",
  "maxVideos": 50
}
```

For popular videos, set `"searchSort": "popular"`; for relevance use `"relevance"`. The same fields work in the Server API. Transcript preferences remain independent. [Discover more Lofomachines Actors](https://apify.com/lofomachines).

### Input examples

#### Find up to 1,000 videos by keyword

```json
{
  "searchQueries": ["espresso machine review"],
  "mode": "fast",
  "maxVideos": 1000
}
```

#### Collect a channel’s videos and Shorts

```json
{
  "startUrls": [{ "url": "https://www.youtube.com/@NASA" }],
  "channelSections": ["videos", "shorts"],
  "maxVideos": 0,
  "mode": "fast"
}
```

#### Collect comments, replies and an available transcript

```json
{
  "startUrls": [{ "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw" }],
  "mode": "complete",
  "includeComments": true,
  "maxComments": 1000,
  "includeTranscripts": true,
  "transcriptLanguages": ["en", "it"]
}
```

#### Collect Community posts

```json
{
  "startUrls": [{ "url": "https://www.youtube.com/@NASA" }],
  "channelSections": ["posts"],
  "maxPosts": 100
}
```

### What does the output look like?

This shortened, illustrative video record shows how a transcript is attached to its video. Values below demonstrate the structure; they are not a measured result from the example URL.

```json
{
  "type": "video",
  "id": "example1234",
  "url": "https://www.youtube.com/watch?v=example1234",
  "title": "Example product review",
  "channelName": "Example channel",
  "durationSeconds": 120,
  "viewCount": 125000,
  "viewCountIsApproximate": true,
  "viewCountText": "125K views",
  "isShort": false,
  "detailsStatus": "available",
  "transcriptStatus": "available",
  "transcript": {
    "status": "available",
    "language": "en",
    "languageName": "English",
    "isAutomatic": true,
    "text": "Welcome to this example review.",
    "segments": [
      {
        "start": 0,
        "duration": 2.4,
        "text": "Welcome to this example review."
      }
    ]
  }
}
```

Each comment is a separate record linked by `videoId` or `postId`, with `source` identifying `video` or `post`. Image-only comments can have empty `text` and nonempty `imageUrls`. Replies include `parentCommentId` and `rootCommentId`, so you can reconstruct conversations without mixing them into a video’s text. Community posts and channel profiles have their own records and datasets.

#### Key output fields

| Fields | Meaning |
| --- | --- |
| `id`, `url`, `type` | Record identity and public YouTube link |
| `sourceUrl`, `searchQuery`, `sourceSection` | Where the record was discovered, when applicable |
| `title`, `description`, `durationSeconds` | Available video information; Fast mode may contain a description snippet |
| `viewCount`, `viewCountText`, `viewCountIsApproximate` | Parsed view count, original label and an indication of abbreviated counts |
| `publishedAt`, `uploadedAt`, `publishedTimeText` | Source-provided dates or original relative labels; relative text is not converted into a fabricated exact date |
| `detailsStatus`, `detailsError` | Whether richer video metadata was retrieved and any reported error |
| `availableCaptionTracks` | Available caption languages and automatic/manual classification |
| `transcriptStatus`, `transcript` | Caption outcome, selected language, full text and timed segments |
| `videoId`, `postId`, `source` | Video or Community post associated with a comment |
| `parentCommentId`, `rootCommentId` | Comment conversation relationships |
| `imageUrls` | Comment image attachments, including image-only comments |
| `scrapedAt` | When the record was collected |

Counts may be rounded by YouTube, change during a run, or be hidden. A public label such as “125K views” is not an exact count. Fields available in Complete mode can vary between videos.

### How much does YouTube scraping cost?

**Starter / Bronze: $0.35 per 1,000 results + $0.003 per start at 512 MB. Platform usage for the run is included.** The Starter result price is 30% lower than the Free plan's $0.50 per 1,000 results.

| Apify plan / discount | Per 1,000 results | Actor Start at 512 MB |
| --- | ---: | ---: |
| Free / no discount | $0.50 | $0.003 |
| **Starter / Bronze** | **$0.35** | **$0.003** |
| Scale / Silver | $0.30 | $0.003 |
| Business / Gold | $0.28 | $0.003 |

The **Result** event currently counts videos saved to the main **Videos** dataset. A transcript attached to a video does not create another Result event. Comments, Community posts and Channels are separate datasets and do not generate an additional Result charge under the current configuration. A 1,000-comment workload is therefore a different unit from 1,000 billed video results.

Example totals on **Starter / Bronze**, with one ordinary start at 512 MB:

| Billed videos | Result charge | Start charge | Total Actor charges |
| ---: | ---: | ---: | ---: |
| 0 | $0.0000 | $0.003 | $0.0030 |
| 2 | $0.0007 | $0.003 | $0.0037 |
| **1,000** | **$0.3500** | **$0.003** | **$0.3530** |

Actor Start is charged per allocated GB, with a minimum of one event. These examples apply to 512 MB and 1 GB; 2 GB means two start events. Taxes, your Apify subscription and separately billed later storage/export operations are outside these examples. A started run can incur its start charge even with no video results. Check the Pricing tab for the current tariff.

For faster catalogue collection, use basic video details and leave comments and transcripts off. Choose full descriptions and metadata from Optional preferences when needed. The Actor handles connections and recovery automatically; no proxy or performance setup is required. Platform usage is covered by the current tariff. Source availability and rate limits can still affect duration and coverage.

A 1,000-video list, 1,000 comments from one video, and 1,000 videos each enriched with transcripts are different workloads. Compare useful content and the collection report with the final Actor charges. Completion time and source availability vary.

### Use cases

- **Content and keyword research:** compare topics, formats and creators before planning a video.
- **Competitor monitoring:** track public uploads, Shorts and Community announcements from selected channels.
- **Audience research:** analyze comments and replies for questions, feedback and recurring themes.
- **Transcript research:** search available spoken content, retain timestamps, and pass text to your own summarization or analysis workflow.
- **Creator discovery:** build structured channel and video lists around relevant search phrases.
- **Reporting and automation:** export results to a spreadsheet, schedule recurring runs, or connect Apify to Make, Zapier and your own API workflows.

### Frequently asked questions

#### Does it collect automatically generated YouTube transcripts?

Yes, when YouTube makes an automatic caption track retrievable. The transcript includes an `isAutomatic` flag, language, full text and timed segments. Manual captions are also supported. The Actor retrieves existing captions; it does not transcribe audio or generate new captions.

#### Can I choose the transcript language?

Choose language names such as English, Italian or Spanish from Optional preferences, in your preferred order. The Actor selects an available matching track, falling back to another available language when necessary. API examples use the corresponding language codes. This preference does not request a new translation.

#### Can it scrape every video and Short from a channel?

Select Videos and Shorts and set the video limit to `0` to follow all pages YouTube exposes. “All” means all discoverable public results in that run. Deleted, private, members-only, restricted or otherwise inaccessible content is not guaranteed. Consult the collection report for each section’s final status.

#### Why did I receive fewer comments than YouTube’s displayed count?

YouTube’s displayed count can include replies, unavailable content and comments not returned under a particular sort order. Moderation, ranking, changes during collection and your own limits can also affect the result. The Actor reports collected rows and stopping reasons rather than assuming the displayed count is recoverable.

Replies are included automatically, up to 100 per top-level comment. The total comments-per-video-or-post limit still applies, and comments are requested in newest-first order.

#### Do full video details automatically turn on comments and transcripts?

No. Full video details request richer metadata. Comments and transcripts remain separate switches so you can choose the output you need.

#### Does it collect Community posts as well as videos?

Yes. Select Community posts for channel URLs. Available post text, images, attachments and poll data are saved separately. Some channels do not expose a public posts section. Switch on Include comments to also collect available public comments and replies on each Community post. They use the same per-source comment limits as videos.

#### Can I use this as a YouTube scraper API?

Yes. The same JSON inputs work through the Apify API, saved tasks and integrations. Separate dataset schemas describe the result types for automation tools and AI agents. You can also run everything from the Apify form without code.

#### What does a blocked transcript mean?

`blocked` means the request could not retrieve captions because access was restricted or challenged. It does not prove that the video has no transcript. `unavailable`, `error` and `not_requested` are separate outcomes; review them before treating empty transcript text as missing captions.

#### Does it download video or audio files?

No. It collects public metadata, text, comments, posts and available captions. Video and audio downloads are outside this Actor’s scope.

### Need help or more data sources?

When reporting an issue, include the run link, the public YouTube source and the expected result. The collection summary is useful for distinguishing a reached limit from a source restriction or collection error. Do not share passwords, session cookies or private tokens.

**Build your next research workflow with more ready-to-run scrapers. [Discover all Lofomachines Actors](https://apify.com/lofomachines).**

### Server API: get YouTube results directly

Connect this scraper to dashboards, AI assistants, Make, n8n or your own app and receive structured JSON in the HTTP response. For large exports and scheduled research, continue using the **Input** tab.

#### Try it without writing code

1. Open the **Server** tab.
2. Expand **POST /scrape**, select **Try it out**, and use the coffee example or replace it with your own source.
3. Select **Execute**. Your response contains `status`, `counts` and `data`, with separate lists for videos, comments, posts, channels.

Send **one link, keyword per request**. Each result limit accepts 1–50, with a default of 10 videos and 20 comments. Comments and transcripts are optional. A collection has a 90-second budget; check `status` for partial or time-limited results. For unlimited collection or several sources, use the Input tab.

#### Request example

Copy the service URL from the Server tab. External integrations authenticate with an Apify API token in the `Authorization: Bearer YOUR_APIFY_TOKEN` header.

```http
POST /scrape
Content-Type: application/json
Authorization: Bearer YOUR_APIFY_TOKEN

{
  "searchQueries": [
    "coffee"
  ],
  "maxVideos": 10,
  "includeComments": false
}
```

#### Response format

The following is an illustrative empty response. Nonempty lists contain the same records documented in the output examples above.

```json
{
  "requestId": "example-request",
  "status": "empty",
  "counts": {
    "videos": 0,
    "comments": 0,
    "posts": 0,
    "channels": 0
  },
  "data": {
    "videos": [],
    "comments": [],
    "posts": [],
    "channels": []
  }
}
```

Only this request's results are returned. **Multi-tenant hosting** shares warm instances across callers while keeping inputs and results isolated. Server results are returned directly, without being saved to a shared dataset. Use the Input tab when you need downloadable datasets or resumable bulk jobs.

Each returned video charges one **Server result** event (`server-result`), using the same plan-based per-result rates as batch collection. Comments and supporting records do not add separate result events. Requests with no videos have no result charge. There is no Actor-start fee per Server request; platform usage is included for callers. Repeating a request performs a new collection and can charge again. See the Pricing tab for the current rates.

Charges are attributed to your authenticated request and completed before the response is sent. If billing cannot be confirmed, the endpoint returns an error without results. Local tests do not charge. As documented by Apify, calls made by the Actor owner update billing statistics without a customer payment.

A busy instance responds with **429** and `Retry-After: 5`. Invalid input returns **400**; a failed collection returns **502**. Reddit or YouTube may restrict access or omit content, and fast responses are not guaranteed. For detailed diagnostics and resumable bulk work, use the Input tab.

Discover more ready-to-use data tools: [Explore all Lofomachines Actors](https://apify.com/lofomachines).

# Actor input Schema

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

Paste video, Short, channel or playlist links. You can combine these with search keywords. Leave empty when searching only by keyword.

## `searchQueries` (type: `array`):

Enter one search phrase per line, such as espresso machine review. Each phrase is searched separately. The prefilled coffee example collects up to 10 results; replace or clear it for your own search.

## `country` (type: `string`):

Choose the YouTube search region. This influences results; it does not restrict videos to creators in that country or change the proxy location.

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

Choose the YouTube search and metadata language. This is not a strict spoken-language filter and does not translate videos. Transcript language is selected separately.

## `searchSort` (type: `string`):

Expanded discovery keeps the existing broad search. Relevance and Popular use one YouTube ranked stream. Newest sorts the collected sample by displayed publication age (ties keep their original order; unknown dates go last), not every matching YouTube video. For Newest choose 1–10,000 videos and use the upload-period filter to focus on recent content. Applies only to keyword searches.

## `maxVideos` (type: `integer`):

Maximum videos for each keyword or playlist, and separately for each selected channel section. Set 0 to continue until YouTube stops returning results. A channel with videos and Shorts selected can return up to twice this limit.

## `channelSections` (type: `array`):

Choose the channel sections you need. Each selected video section has its own video limit. Community posts use the separate post limit below. Hidden or unavailable sections are reported in the run summary.

## `includeComments` (type: `boolean`):

Also save public comments and replies from videos, Shorts and Community posts in the Comments dataset.

## `maxComments` (type: `integer`):

Maximum comments and replies per video or Community post. Replies are included automatically, up to 100 replies per top-level comment. Use 0 for no total comment cap.

## `includeTranscripts` (type: `boolean`):

Save available automatic or manual captions as text with timestamps. Videos without accessible captions are reported in the results. This retrieves existing captions; it does not transcribe audio.

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

Fast collects the information shown in search results and channel lists with fewer requests. Complete visits each video for richer metadata. Comments and transcripts are separate optional extras.

## `transcriptLanguages` (type: `array`):

Choose languages in preference order. If none matches, another available caption track is used. This does not translate the video. Leave empty to use an available track.

## `maxPosts` (type: `integer`):

Maximum public Community posts for each channel when Community posts is selected. Set 0 to continue until YouTube stops returning posts.

## `searchDate` (type: `string`):

Filter keyword search results by YouTube upload period. Applies to search only; it is not an exact publication-date filter.

## Actor input object example

```json
{
  "startUrls": [],
  "searchQueries": [
    "coffee"
  ],
  "country": "US",
  "language": "en",
  "searchSort": "expanded",
  "maxVideos": 10,
  "channelSections": [
    "videos",
    "shorts"
  ],
  "includeComments": false,
  "maxComments": 10,
  "includeTranscripts": false,
  "mode": "fast",
  "transcriptLanguages": [
    "en"
  ],
  "maxPosts": 10,
  "searchDate": "all"
}
```

# Actor output Schema

## `videos` (type: `string`):

Video and Short records, with optional detailed metadata and transcripts.

## `comments` (type: `string`):

Comments linked to their video or Community post and parent comment.

## `posts` (type: `string`):

Public channel Community post records.

## `channels` (type: `string`):

Available public profiles of requested channels.

## `run_summary` (type: `string`):

Counts, source outcomes, limits, errors and collection completeness.

## `output` (type: `string`):

Dataset identifiers and export links for this run.

# 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 = {
    "startUrls": [],
    "searchQueries": [
        "coffee"
    ],
    "maxVideos": 10,
    "channelSections": [
        "videos",
        "shorts"
    ],
    "includeComments": false,
    "maxComments": 10,
    "includeTranscripts": false,
    "mode": "fast",
    "transcriptLanguages": [
        "en"
    ],
    "maxPosts": 10,
    "searchDate": "all"
};

// Run the Actor and wait for it to finish
const run = await client.actor("lofomachines/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 = {
    "startUrls": [],
    "searchQueries": ["coffee"],
    "maxVideos": 10,
    "channelSections": [
        "videos",
        "shorts",
    ],
    "includeComments": False,
    "maxComments": 10,
    "includeTranscripts": False,
    "mode": "fast",
    "transcriptLanguages": ["en"],
    "maxPosts": 10,
    "searchDate": "all",
}

# Run the Actor and wait for it to finish
run = client.actor("lofomachines/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 '{
  "startUrls": [],
  "searchQueries": [
    "coffee"
  ],
  "maxVideos": 10,
  "channelSections": [
    "videos",
    "shorts"
  ],
  "includeComments": false,
  "maxComments": 10,
  "includeTranscripts": false,
  "mode": "fast",
  "transcriptLanguages": [
    "en"
  ],
  "maxPosts": 10,
  "searchDate": "all"
}' |
apify call lofomachines/youtube-scraper --silent --output-dataset

```

## MCP server setup

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