# YouTube Channel API - Videos, Views & Subs (`stas_k/youtube-channel-api`) Actor

Most channel scrapers never tell you which channels failed, and a list you build by hand goes stale before you paste it. This actor returns one row per video with views, age, duration and link, and every channel it could not read comes back free with the reason.

- **URL**: https://apify.com/stas_k/youtube-channel-api.md
- **Developed by:** [Stas K](https://apify.com/stas_k) (community)
- **Categories:** Social media, Developer tools, SEO tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.20 / 1,000 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 Channel API - Videos, Views and Subscribers

You should not have to open a channel, scroll its Videos tab by hand and copy ids one at
a time. Give this actor a channel handle, a channel url or a channel id, and it returns one
row per video: the id, a direct `youtube.com/watch?v=<id>` link, the title, the view count
as a number and as shown, the age, the duration in seconds, the position on the tab and the
thumbnail. The channel's own subscriber line is repeated on every row, so a sheet of videos
still says whose they are. Paging follows the continuation token the page itself hands back,
so a channel with thousands of uploads is covered, not just the first screen.

### What you get

One row per video:

| field | meaning |
|---|---|
| `channelInput` | the channel exactly as you sent it |
| `channelId`, `channelTitle` | the resolved channel id (`UC...`) and its title |
| `channelSubscribersText` | the subscriber line the page shows (`30.7M subscribers`) |
| `videoId`, `url` | the id and `https://www.youtube.com/watch?v=<id>` |
| `title` | as the tab shows it |
| `views`, `viewsText` | view count as a number and as shown (`92M views`) |
| `ageText`, `ageDays` | age as the page states it, and that age as a lower bound in days |
| `durationText`, `durationSeconds` | length, both as shown and in seconds |
| `position` | its place on the Videos tab, starting at 0 |
| `thumbnailUrl` | the cover image YouTube shows |
| `status`, `billable` | `OK` for a delivered video; a status row carries a reason instead of data |

### Depth, measured

On 2026-11-12 one Videos page returned **30 videos and a continuation token**, and three
pages gave **90 unique** videos. `maxVideosPerChannel` defaults to 50 and is capped at 1000.
The tab is found on the channel page itself: the actor reads the tab list and takes the
Videos params from it, so a change to YouTube's own tabs does not silently turn into an
empty run.

The current YouTube layout renders the Videos tab as `lockupViewModel`, not `videoRenderer`;
the id sits in `contentId` and views and age in `metadataRows`. That is why the rows carry a
number and a text for views: "92M views" is what the page says, and 92000000 is what it
means.

### What this actor does not do

- It does not read Shorts. They live on their own tab and in a different actor.
- It does not read comments, captions or transcripts.
- It does not return exact upload timestamps: YouTube shows an age ("11 days ago"), so
  `ageDays` is a lower bound, not a date. Do not treat it as one.
- It does not search by keyword. It reads channels you name; a channel with no Videos tab
  comes back as a free row saying so.
- It does not bypass a block. If YouTube answers something other than a channel or a video
  list, the row says so and costs nothing.

### Money

Price: **$0.0002 per delivered video** (`video-delivered`), the lowest spending limit you can set per run is $0.05.

A row is charged only when it reached the dataset. A status row never carries a video id, a
title, a thumbnail or a view count, so it can never be mistaken for the product.

Free, with the reason in the row:

| status | when |
|---|---|
| `INVALID_INPUT` | the channel could not be resolved from what you sent |
| `DUPLICATE` | the same channel appears twice in one run |
| `NO_VIDEOS_FOUND` | the channel has no Videos tab, or the tab is open and empty |
| `NOT_CHECKED_LIMIT` | beyond `maxVideosPerChannel` |
| `NOT_CHECKED_TIME` | not enough time before the platform deadline |
| `NOT_CHECKED_ERROR` | the channel or video page could not be read; the reason names the error |
| `NOT_CHECKED_CAP` | the spending cap leaves no budget |
| `NOT_CHECKED_BILLING` | the price could not be read, so nothing is sold |
| `NOT_CHECKED_CHARGE_UNVERIFIED` | the charge failed and the row was not confirmed |

`stopReason` names the money fact first: `spending-cap`, `billing-price-unknown`,
`charge-error`, `dataset-write-error` or `deadline`. `counterMismatch` in the summary is
`true` when delivered rows do not add up to charged plus delivered-unpaid, and `datasetNote`
explains a doubt the counters cannot express.

### Input

| field | default | meaning |
|---|---|---|
| `channels` | required | handles, urls or channel ids, one or more |
| `maxVideosPerChannel` | 50 | stop after this many videos per channel |
| `region` | US | two letter country code that shapes the mix |
| `language` | en | two letter language code for titles and labels |

### Resource use

512 MB of memory and no browser: the actor talks to the public innertube endpoint with
plain HTTP, so a run of 100 videos finishes in seconds.

### Status of this build

`0.1`. The parsing is checked against a saved real channel page and a saved real Videos page,
and the money path is checked by running the real `main()` against a stand that repeats the
SDK, including its silent cut of a batch that does not fit the budget.

# Actor input Schema

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

One or more channels: a handle (@MrBeast), a channel url or a channel id (UC...). Each channel is read once and gives its own rows.

## `maxVideosPerChannel` (type: `integer`):

Stop after this many videos for each channel. Paging follows the page's own continuation token, about 30 videos per page.

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

Two letter country code that shapes the mix, for example US or DE.

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

Two letter language code for titles and labels, for example en or de.

## Actor input object example

```json
{
  "channels": [
    "@MrBeast",
    "@Google"
  ],
  "maxVideosPerChannel": 50,
  "region": "US",
  "language": "en"
}
```

# Actor output Schema

## `dataset` (type: `string`):

Every delivered video has channelInput, channelId, channelTitle, channelSubscribersText, videoId, url, title, views, viewsText, ageText, ageDays, durationText, durationSeconds, position and thumbnailUrl. Rows with a status other than OK carry a reason instead of data.

## `summary` (type: `string`):

Counters, chargedEvents, byStatus, stopReason, datasetNote and counterMismatch. Status codes: OK, INVALID_INPUT, DUPLICATE, NO_VIDEOS_FOUND, NOT_CHECKED_LIMIT, NOT_CHECKED_TIME, NOT_CHECKED_ERROR, NOT_CHECKED_CAP, NOT_CHECKED_BILLING, NOT_CHECKED_CHARGE_UNVERIFIED. Stop reasons: spending-cap, billing-price-unknown, charge-error, dataset-write-error, deadline.

# 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 = {
    "channels": [
        "@MrBeast",
        "@Google"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("stas_k/youtube-channel-api").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 = { "channels": [
        "@MrBeast",
        "@Google",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("stas_k/youtube-channel-api").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 '{
  "channels": [
    "@MrBeast",
    "@Google"
  ]
}' |
apify call stas_k/youtube-channel-api --silent --output-dataset

```

## MCP server setup

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

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/eA26jgVoZVehUpl42/builds/zJLuxNeBJVgDIVcgC/openapi.json
