# YouTube Scraper (`icoe-man/youtube-scraper`) Actor

A youtube comments scraper and more: collect public videos, shorts, playlists, community posts, comments and replies from YouTube channels and links. Export JSON, CSV or Excel.

- **URL**: https://apify.com/icoe-man/youtube-scraper.md
- **Developed by:** [Icoe Man](https://apify.com/icoe-man) (community)
- **Categories:** Social media, Videos
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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

Download public YouTube data as a table you can use in other tools, without copying it by hand. Enter a channel or paste a link, then use What to collect to choose the data you need. You can collect a channel's videos, Shorts, playlists or community posts, get details for a single video or post, or list the videos in a playlist. To collect replies, use the code from your Video comments results. Creator emails returns only the public business contact email addresses a channel lists.

### What you get

Under **What to collect**, choose the type of results you want. Fill in the fields for that choice, then start the run. Each run returns one kind of result. The Actor ignores fields from other modes. Use full web addresses. If you have a short link, open it and copy the full address from your browser's address bar. Choose **Live** under **Data freshness** to collect fresh data on every run.

### Collection modes

#### Channel videos

Get a channel's public videos, newest or most viewed first. In `channel-videos` mode, fill in **Channels** (up to 100 entries), and **Order** (optional), **Uploads from** (optional). Use **Result limit per target** to set how many posts the Actor can collect per entry. The default is 100 and the highest setting is 1000. Each post appears in its own row and counts as one **Channel videos** charge.

Example result for one post:

```json
{
  "status": "ok",
  "type": "post",
  "platform": "youtube",
  "id": "eXrd5sNdacA",
  "url": "https://www.youtube.com/watch?v=eXrd5sNdacA",
  "author": {
    "id": "UCLA_DiR1FfKNvjuUpBHmylQ",
    "username": "NASA",
    "displayName": "NASA"
  },
  "text": "A short example sentence about a space mission, shown for illustration.",
  "createdAt": "2026-11-09T17:08:54Z",
  "metrics": {
    "likes": 896,
    "comments": null,
    "views": 60193
  },
  "hashtags": [],
  "mentions": [],
  "media": [
    {
      "kind": "video",
      "url": "https://www.youtube.com/watch?v=eXrd5sNdacA",
      "thumbnailUrl": "https://i.ytimg.com/vi/LHUvedAssyE/hqdefault.jpg",
      "durationSec": 87
    }
  ],
  "details": {
    "youtube": {
      "kind": "video",
      "title": "An example video title for illustration",
      "durationSec": 87,
      "genre": "Science & Technology",
      "timeApproximate": false
    }
  },
  "collectedAt": "2026-11-11T12:00:00Z",
  "input": {
    "channel": "@NASA",
    "maxItems": 20
  }
}
```

#### Channel shorts

Get a channel's dated public Shorts in order of newest or most viewed. In `channel-shorts` mode, fill in **Channels** (up to 100 entries), and **Order** (optional), **Uploads from** (optional). Use **Result limit per target** to set how many posts the Actor can collect per entry. The default is 100 and the highest setting is 1000. Each post appears in its own row and counts as one **Channel shorts** charge.

Example result for one post:

```json
{
  "status": "ok",
  "type": "post",
  "platform": "youtube",
  "id": "k5Z7sFwFF7Q",
  "url": "https://www.youtube.com/watch?v=k5Z7sFwFF7Q",
  "author": {
    "id": "UCLA_DiR1FfKNvjuUpBHmylQ",
    "username": "NASA",
    "displayName": "NASA"
  },
  "text": "A short example sentence about a space mission, shown for illustration.",
  "createdAt": "2026-11-09T17:08:54Z",
  "metrics": {
    "likes": 896,
    "comments": null,
    "views": 60193
  },
  "hashtags": [],
  "mentions": [],
  "media": [
    {
      "kind": "video",
      "url": "https://www.youtube.com/watch?v=k5Z7sFwFF7Q",
      "thumbnailUrl": "https://i.ytimg.com/vi/LHUvedAssyE/hqdefault.jpg",
      "durationSec": 64
    }
  ],
  "details": {
    "youtube": {
      "kind": "short",
      "title": "An example video title for illustration",
      "durationSec": 64,
      "genre": "Science & Technology",
      "timeApproximate": false
    }
  },
  "collectedAt": "2026-11-11T12:00:00Z",
  "input": {
    "channel": "@NASA",
    "maxItems": 20
  }
}
```

#### Channel playlists

See a channel's public playlists, including each playlist's video count and cover image. In `channel-playlists` mode, fill in **Channels** (up to 100 entries). Use **Result limit per target** to set how many collections the Actor can collect per entry. The default is 100 and the highest setting is 1000. Each collection appears in its own row and counts as one **Channel playlists** charge.

Example result for one collection:

```json
{
  "status": "ok",
  "type": "collection",
  "platform": "youtube",
  "id": "PL2aBZuCeDwlRaF6AIey7ulmW1X0SHI1mQ",
  "url": "https://www.youtube.com/playlist?list=PL2aBZuCeDwlRaF6AIey7ulmW1X0SHI1mQ",
  "title": "An example playlist title",
  "owner": {
    "id": "UCLA_DiR1FfKNvjuUpBHmylQ",
    "username": "NASA",
    "displayName": "NASA"
  },
  "itemsCount": 3,
  "coverUrl": "https://i.ytimg.com/vi/LHUvedAssyE/hqdefault.jpg",
  "details": {
    "youtube": {
      "kind": "playlist"
    }
  },
  "collectedAt": "2026-11-11T12:00:00Z",
  "input": {
    "channel": "@NASA",
    "maxItems": 20
  }
}
```

#### Channel community posts

Get a channel's public community posts with an estimated time for each post. In `channel-communityposts` mode, fill in **Channels** (up to 100 entries). Use **Result limit per target** to set how many posts the Actor can collect per entry. The default is 100 and the highest setting is 1000. Each post appears in its own row and counts as one **Channel community posts** charge.

Example result for one post:

```json
{
  "status": "ok",
  "type": "post",
  "platform": "youtube",
  "id": "Ugkx0X33g-nAj6FyciU8R9pJUCrPERrtPBJE",
  "url": "https://www.youtube.com/post/Ugkx0X33g-nAj6FyciU8R9pJUCrPERrtPBJE",
  "author": {
    "id": "UCLA_DiR1FfKNvjuUpBHmylQ",
    "username": "NASA",
    "displayName": "NASA"
  },
  "text": "A short example sentence about a space mission, shown for illustration.",
  "createdAt": "2026-11-07T00:03:13Z",
  "metrics": {
    "likes": 356
  },
  "hashtags": [],
  "mentions": [],
  "media": [],
  "details": {
    "youtube": {
      "kind": "communityPost",
      "timeApproximate": true
    }
  },
  "collectedAt": "2026-11-11T12:00:00Z",
  "input": {
    "channel": "@NASA",
    "maxItems": 20
  }
}
```

#### Video

For a video or Short, get its title, publish date, counts for views, likes and comments, length, tags, chapters, description links, caption languages and the channel's subscriber count. In `video-get` mode, fill in **Video links** (up to 100 entries). You get one post per entry. Each post appears in its own row and counts as one **Video** charge.

Example result for one post:

```json
{
  "status": "ok",
  "type": "post",
  "platform": "youtube",
  "id": "LHUvedAssyE",
  "url": "https://www.youtube.com/watch?v=LHUvedAssyE",
  "author": {
    "id": "UCLA_DiR1FfKNvjuUpBHmylQ",
    "username": "NASA",
    "displayName": "NASA",
    "verified": true
  },
  "text": "A short example sentence about a space mission, shown for illustration.",
  "createdAt": "2026-11-09T17:08:54Z",
  "metrics": {
    "likes": 27003,
    "comments": 1300,
    "views": 1522094
  },
  "hashtags": [],
  "mentions": [],
  "media": [
    {
      "kind": "video",
      "url": "https://www.youtube.com/watch?v=LHUvedAssyE",
      "thumbnailUrl": "https://i.ytimg.com/vi/LHUvedAssyE/hqdefault.jpg",
      "durationSec": 87
    }
  ],
  "details": {
    "youtube": {
      "kind": "video",
      "title": "An example video title for illustration",
      "durationSec": 88,
      "genre": "Science & Technology",
      "isPaidPromotion": false,
      "isMadeWithAI": false,
      "timeApproximate": false,
      "tags": [
        "nasa",
        "artemis"
      ],
      "chapters": [
        {
          "title": "Introduction",
          "startSec": 0
        }
      ],
      "descriptionLinks": [
        "https://www.youtube.com/@NASA"
      ],
      "channelSubscribers": 15100000,
      "captionLanguages": [
        {
          "language": "en",
          "name": "English",
          "autoGenerated": false
        }
      ]
    }
  },
  "collectedAt": "2026-11-11T12:00:00Z",
  "input": {
    "url": "https://www.youtube.com/watch?v=LHUvedAssyE",
    "maxItems": 1
  }
}
```

#### Community post

Paste a community post link to get the post details, including an estimate of when it was published. In `communitypost-get` mode, fill in **Community post links** (up to 100 entries). You get one post per entry. Each post appears in its own row and counts as one **Community post** charge.

Example result for one post:

```json
{
  "status": "ok",
  "type": "post",
  "platform": "youtube",
  "id": "Ugkx0X33g-nAj6FyciU8R9pJUCrPERrtPBJE",
  "url": "https://www.youtube.com/post/Ugkx0X33g-nAj6FyciU8R9pJUCrPERrtPBJE",
  "author": {
    "id": "UCLA_DiR1FfKNvjuUpBHmylQ",
    "username": "NASA",
    "displayName": "NASA"
  },
  "text": "A short example sentence about a space mission, shown for illustration.",
  "createdAt": "2026-11-07T00:03:13Z",
  "metrics": {
    "likes": 356
  },
  "hashtags": [],
  "mentions": [],
  "media": [],
  "details": {
    "youtube": {
      "kind": "communityPost",
      "timeApproximate": true
    }
  },
  "collectedAt": "2026-11-11T12:00:00Z",
  "input": {
    "url": "https://www.youtube.com/post/Ugkx0X33g-nAj6FyciU8R9pJUCrPERrtPBJE",
    "maxItems": 1
  }
}
```

#### Playlist videos

Get a list of the videos in a public playlist without their publish dates. In `playlist-videos` mode, fill in **Playlist links** (up to 100 entries). Use **Result limit per target** to set how many posts the Actor can collect per entry. The default is 100 and the highest setting is 5000. Each post appears in its own row and counts as one **Playlist videos** charge.

Example result for one post:

```json
{
  "status": "ok",
  "type": "post",
  "platform": "youtube",
  "id": "yMoGiIeDH9s",
  "url": "https://www.youtube.com/watch?v=yMoGiIeDH9s",
  "author": {
    "username": "NASA",
    "displayName": "NASA"
  },
  "text": "An example video title for illustration",
  "metrics": {},
  "media": [
    {
      "kind": "video",
      "url": "https://www.youtube.com/watch?v=yMoGiIeDH9s",
      "thumbnailUrl": "https://i.ytimg.com/vi/yMoGiIeDH9s/hqdefault.jpg",
      "durationSec": 333
    }
  ],
  "details": {
    "youtube": {
      "kind": "video",
      "title": "An example video title for illustration",
      "durationSec": 333,
      "timeApproximate": false
    }
  },
  "collectedAt": "2026-11-11T12:00:00Z",
  "input": {
    "url": "https://www.youtube.com/playlist?list=PL2aBZuCeDwlRaF6AIey7ulmW1X0SHI1mQ",
    "maxItems": 20
  }
}
```

#### Video comments

Get a video's public comments with estimated posting times, starting with the top or newest comments. In `video-comments` mode, fill in **Video links** (up to 100 entries), and **Comment order** (optional). Use **Result limit per target** to set how many comments the Actor can collect per entry. The default is 100 and the highest setting is 1000. Each comment appears in its own row and counts as one **Video comments** charge.

Example result for one comment:

```json
{
  "status": "ok",
  "type": "comment",
  "platform": "youtube",
  "id": "UgxExample0000000000AaABAg",
  "url": "https://www.youtube.com/watch?v=LHUvedAssyE&lc=UgxExample0000000000AaABAg",
  "postId": "LHUvedAssyE",
  "author": {
    "id": "UCexample0000000000000000",
    "username": "example_user",
    "verified": false
  },
  "text": "A short example comment, shown for illustration.",
  "createdAt": "2026-04-12T01:03:41Z",
  "metrics": {
    "likes": 761,
    "replies": 21
  },
  "details": {
    "youtube": {
      "repliesToken": "eyJ2IjoiTEhVdmVkQXNzeUUiLCJjIjoiVWd4RXhhbXBsZTAwMDAwMDAwMDBBYUFCQWciLCJ0IjoiZXhhbXBsZS10b2tlbiJ9",
      "isCreator": false,
      "timeApproximate": true
    }
  },
  "collectedAt": "2026-11-11T12:00:00Z",
  "input": {
    "url": "https://www.youtube.com/watch?v=LHUvedAssyE",
    "maxItems": 20
  }
}
```

#### Comment replies

Get the public replies to a comment, with an estimate of when each reply was posted. In `comment-replies` mode, fill in **Replies tokens** (up to 100 entries). Use **Result limit per target** to set how many comments the Actor can collect per entry. The default is 100 and the highest setting is 1000. Each comment appears in its own row and counts as one **Comment replies** charge.

Example result for one comment:

```json
{
  "status": "ok",
  "type": "comment",
  "platform": "youtube",
  "id": "UgxExample0000000000AaABAg.AExample0000000",
  "url": "https://www.youtube.com/watch?v=LHUvedAssyE&lc=UgxExample0000000000AaABAg.AExample0000000",
  "postId": "LHUvedAssyE",
  "parentId": "UgxExample0000000000AaABAg",
  "author": {
    "id": "UCexample0000000000000001",
    "username": "example_user",
    "verified": false
  },
  "text": "A short example reply, shown for illustration.",
  "createdAt": "2026-04-12T01:05:55Z",
  "metrics": {
    "likes": 38,
    "replies": 3
  },
  "details": {
    "youtube": {
      "isCreator": false,
      "timeApproximate": true
    }
  },
  "collectedAt": "2026-11-11T12:00:00Z",
  "input": {
    "repliesToken": "eyJ2IjoiTEhVdmVkQXNzeUUiLCJjIjoiVWd4RXhhbXBsZTAwMDAwMDAwMDBBYUFCQWciLCJ0IjoiZXhhbXBsZS10b2tlbiJ9",
    "maxItems": 20
  }
}
```

#### Creator emails

Creator emails returns only the public business contact email addresses a channel lists and isn't available on the free plan; you pay nothing for channels that list none. In `creator-emails` mode, fill in **Channels** (up to 100 entries). You get one profile per entry. Each profile appears in its own row and counts as one **Creator emails** charge.

Example result for one profile:

```json
{
  "status": "ok",
  "type": "profile",
  "platform": "youtube",
  "id": "UCLA_DiR1FfKNvjuUpBHmylQ",
  "url": "https://www.youtube.com/channel/UCLA_DiR1FfKNvjuUpBHmylQ",
  "username": null,
  "details": {
    "youtube": {
      "emails": [
        {
          "address": "contact@example.invalid",
          "sourceUrl": "https://www.youtube.com/@NASA/about"
        }
      ]
    }
  },
  "collectedAt": "2026-11-11T12:00:00Z",
  "input": {
    "channel": "UCLA_DiR1FfKNvjuUpBHmylQ",
    "maxItems": 1
  }
}
```

### Ways to use the data

- Compare a channel's uploads by publish date and view count.
- Read video comments and replies to spot common questions and feedback.
- Compare the topics a channel covers by gathering its community posts in one place.
- Export the videos in a public playlist as a table.
- Save a video's public view, like and comment counts for your report.

### What to enter

| Field key | Name on the form | What to enter |
| --- | --- | --- |
| `mode` | What to collect | Choose one type of result per run, then fill in the fields for that choice. |
| `channels` | Channels | Enter a YouTube handle like @NASA, a channel link like https://www.youtube.com/@NASA, or a channel ID that starts with UC. |
| `sortBy` | Order | For Channel videos and Channel shorts, 'newest' (the default) puts the latest uploads first. Choose 'popular' to see the most viewed uploads first. Leave Uploads from blank if you choose 'popular'. |
| `postedAfter` | Uploads from | Enter a date like 2026-11-01 (UTC) to collect uploads from that day onward. Leave blank to include any date. This filter works in Channel videos and Channel shorts with 'newest' only. You may get fewer results than you asked for, and the run stops if three pages in a row have no matches. |
| `videoUrls` | Video links | Paste full YouTube video links like https://www.youtube.com/watch?v=LHUvedAssyE. You can also paste Shorts or youtu.be links. |
| `postUrls` | Community post links | Paste full YouTube community post links like https://www.youtube.com/post/Ugkx0X33g-nAj6FyciU8R9pJUCrPERrtPBJE |
| `playlistUrls` | Playlist links | Paste full YouTube playlist links like https://www.youtube.com/playlist?list=PL2aBZuCeDwlRaF6AIey7ulmW1X0SHI1mQ |
| `commentOrder` | Comment order | 'top' (the default) puts top comments first. Choose 'newest' to start with the latest comments and reach further back on videos with lots of comments. |
| `repliesTokens` | Replies tokens | Copy the repliesToken code from a comment with replies in your Video comments results, then paste it here. |
| `maxItems` | Result limit per target | Set the most results to collect from each target, up to the mode's maximum. Leave this blank to use the mode's default limit. The limit you set doesn't apply to these modes, which return one result per target: Video, Community post and Creator emails. |
| `freshness` | Data freshness | Standard can return results faster when recently collected data is available. Choose Live to collect fresh data on every run. |

Example input:

```json
{
  "mode": "channel-videos",
  "channels": [
    "@NASA"
  ],
  "maxItems": 10,
  "freshness": "standard"
}
```

### Your results

Each mode has its own view of the results table. See **Collection modes** for what each mode returns.

Every row has a `status` field. For each entry that fails, the Actor returns one row with `status: "error"`. The `error` field has a `code` and a `message`. If a required field for your mode is blank, the run returns one error row and collects no data.

### Pricing

You pay per result. Prices for each Apify plan are in USD per 1,000 results.

| What you pay for | Free | Bronze | Silver | Gold | Platinum | Diamond |
| --- | --- | --- | --- | --- | --- | --- |
| Channel community posts | $2.925 | $2.250 | $1.875 | $1.500 | $1.500 | $1.500 |
| Channel playlists | $2.925 | $2.250 | $1.875 | $1.500 | $1.500 | $1.500 |
| Channel shorts | $2.925 | $2.250 | $1.875 | $1.500 | $1.500 | $1.500 |
| Channel videos | $2.925 | $2.250 | $1.875 | $1.500 | $1.500 | $1.500 |
| Comment replies | $1.372 | $1.125 | $0.977 | $0.847 | $0.847 | $0.847 |
| Community post | $4.289 | $3.300 | $3.300 | $3.300 | $3.300 | $3.300 |
| Creator emails | $99.900 | $90.000 | $82.800 | $72.000 | $72.000 | $72.000 |
| Playlist videos | $2.925 | $2.250 | $1.875 | $1.500 | $1.500 | $1.500 |
| Video comments | $1.372 | $1.125 | $0.977 | $0.847 | $0.847 | $0.847 |
| Video | $4.289 | $3.300 | $3.300 | $3.300 | $3.300 | $3.300 |

You don't pay for errors or empty results. The run stops when it reaches your spending limit.

On the free plan, you can collect up to 10 results per run and make up to 20 runs per day.

### Common questions

#### Which mode should I choose?

To see what a channel has published, choose Channel videos, Channel shorts, Channel playlists or Channel community posts. For details on a single item, choose Video or Community post. Playlist videos lists the videos in a playlist. Choose Video comments for the comments on a video and Comment replies for the replies to a comment. Creator emails returns only the business email addresses the channel lists publicly. If a channel handle doesn't exist, the Actor returns no results for it.

#### Can I sort uploads by views or collect them from a certain date?

Yes. In Channel videos or Channel shorts, set Order to 'popular' to see the most viewed uploads first. To collect uploads from a certain date onward, keep Order set to 'newest' (the default) and enter a date in Uploads from. In Video comments, Comment order defaults to 'top'. Choose 'newest' to start with recent comments and collect older ones further back on videos with lots of comments.

#### What details does Video return?

You get the title, publish date and video length, plus counts for views, likes and comments. The results also include tags, chapters, caption languages and links as written in the description. The subscriber count is rounded as YouTube displays it, for example 15.1M. If there's nothing to report for a list, that list is empty.

#### Which dates and times are exact?

If the results include a publish date for a video or Short, that date is exact. For comments, replies and community posts, YouTube shows labels like "2 days ago". The Actor uses those labels to estimate the time and marks it as approximate.

#### How do I collect replies to a comment?

Run Video comments first and copy the repliesToken code from a comment with replies. Then choose Comment replies and paste the code into Replies tokens.

#### What does Creator emails return?

Creator emails returns only the business email addresses a channel lists publicly. If the channel lists none, you get no result and pay nothing for that channel. This mode isn't available on the free plan. Follow applicable laws and YouTube's terms when using these addresses.

#### Will I get Shorts that don't show a publish date?

Channel shorts skips Shorts that don't show a publish date. Playlist videos lists the videos in a playlist, but doesn't include their publish dates.

#### Do I need a YouTube account to run this Actor?

No. The Actor collects only public data. You don't need to sign in to YouTube or share browser cookies.

#### How do I limit my results, and what do I pay for?

Set Result limit per target to the most results you want from each channel, link or other input. You pay only for the results you receive. Errors and empty results cost nothing, and the run stops when it reaches your spending limit.

#### Is this tool affiliated with YouTube?

No. This independent tool isn't affiliated with, endorsed by or sponsored by YouTube. It collects only information that's public on YouTube.

### Disclaimer

This Actor is not affiliated with, endorsed by, or sponsored by YouTube. All trademarks belong to their owners.

# Actor input Schema

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

Choose one type of result per run, then fill in the fields for that choice.

## `channels` (type: `array`):

Enter a YouTube handle like @NASA, a channel link like https://www.youtube.com/@NASA, or a channel ID that starts with UC.

## `sortBy` (type: `string`):

For Channel videos and Channel shorts, 'newest' (the default) puts the latest uploads first. Choose 'popular' to see the most viewed uploads first. Leave Uploads from blank if you choose 'popular'.

## `postedAfter` (type: `string`):

Enter a date like 2026-11-01 (UTC) to collect uploads from that day onward. Leave blank to include any date. This filter works in Channel videos and Channel shorts with 'newest' only. You may get fewer results than you asked for, and the run stops if three pages in a row have no matches.

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

Paste full YouTube video links like https://www.youtube.com/watch?v=LHUvedAssyE. You can also paste Shorts or youtu.be links.

## `postUrls` (type: `array`):

Paste full YouTube community post links like https://www.youtube.com/post/Ugkx0X33g-nAj6FyciU8R9pJUCrPERrtPBJE

## `playlistUrls` (type: `array`):

Paste full YouTube playlist links like https://www.youtube.com/playlist?list=PL2aBZuCeDwlRaF6AIey7ulmW1X0SHI1mQ

## `commentOrder` (type: `string`):

'top' (the default) puts top comments first. Choose 'newest' to start with the latest comments and reach further back on videos with lots of comments.

## `repliesTokens` (type: `array`):

Copy the repliesToken code from a comment with replies in your Video comments results, then paste it here.

## `maxItems` (type: `integer`):

Set the most results to collect from each target, up to the mode's maximum. Leave this blank to use the mode's default limit. The limit you set doesn't apply to these modes, which return one result per target: Video, Community post and Creator emails.

## `freshness` (type: `string`):

Standard can return results faster when recently collected data is available. Choose Live to collect fresh data on every run.

## Actor input object example

```json
{
  "mode": "channel-videos",
  "channels": [
    "@NASA"
  ],
  "videoUrls": [
    "https://www.youtube.com/watch?v=LHUvedAssyE"
  ],
  "postUrls": [
    "https://www.youtube.com/post/Ugkx0X33g-nAj6FyciU8R9pJUCrPERrtPBJE"
  ],
  "playlistUrls": [
    "https://www.youtube.com/playlist?list=PL2aBZuCeDwlRaF6AIey7ulmW1X0SHI1mQ"
  ],
  "repliesTokens": [],
  "maxItems": 10,
  "freshness": "standard"
}
```

# Actor output Schema

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

See everything this run collected in one table.

# 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 = {
    "mode": "channel-videos",
    "channels": [
        "@NASA"
    ],
    "videoUrls": [
        "https://www.youtube.com/watch?v=LHUvedAssyE"
    ],
    "postUrls": [
        "https://www.youtube.com/post/Ugkx0X33g-nAj6FyciU8R9pJUCrPERrtPBJE"
    ],
    "playlistUrls": [
        "https://www.youtube.com/playlist?list=PL2aBZuCeDwlRaF6AIey7ulmW1X0SHI1mQ"
    ],
    "repliesTokens": [],
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("icoe-man/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 = {
    "mode": "channel-videos",
    "channels": ["@NASA"],
    "videoUrls": ["https://www.youtube.com/watch?v=LHUvedAssyE"],
    "postUrls": ["https://www.youtube.com/post/Ugkx0X33g-nAj6FyciU8R9pJUCrPERrtPBJE"],
    "playlistUrls": ["https://www.youtube.com/playlist?list=PL2aBZuCeDwlRaF6AIey7ulmW1X0SHI1mQ"],
    "repliesTokens": [],
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("icoe-man/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 '{
  "mode": "channel-videos",
  "channels": [
    "@NASA"
  ],
  "videoUrls": [
    "https://www.youtube.com/watch?v=LHUvedAssyE"
  ],
  "postUrls": [
    "https://www.youtube.com/post/Ugkx0X33g-nAj6FyciU8R9pJUCrPERrtPBJE"
  ],
  "playlistUrls": [
    "https://www.youtube.com/playlist?list=PL2aBZuCeDwlRaF6AIey7ulmW1X0SHI1mQ"
  ],
  "repliesTokens": [],
  "maxItems": 10
}' |
apify call icoe-man/youtube-scraper --silent --output-dataset

```

## MCP server setup

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