# YouTube Channel Videos (Official Data API) (`shadowell/youtube-channel-videos`) Actor

- **URL**: https://apify.com/shadowell/youtube-channel-videos.md
- **Developed by:** [FENG JIE](https://apify.com/shadowell) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 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 Videos (Official Data API)

Lists a channel's uploaded videos using **only the official YouTube Data API v3** with **your own API key**. No page scraping, no downloaders, no browser.

### Input

- `apiKey` (required, secret): Google Cloud API key with YouTube Data API v3 enabled.
- `channels`: URLs (`/@handle`, `/channel/UC…`, `/c/name`, `/user/name`), `@handles`, or channel IDs.
- `maxVideosPerChannel` (50), `publishedAfter` / `publishedBefore`, `includeVideoDetails` (on), `skipShorts` (heuristic: duration ≤ 60 s; not an official Shorts flag), `descriptionMaxLength` (0 = full), `allowSearchFallback` (off).

### How it works and quota

Default quota is 10,000 units/day per Google Cloud project. Costs (official): `channels.list` 1, `playlistItems.list` 1, `videos.list` 1, `search.list` 100.

1. Resolve channel with `channels.list` (`id` / `forHandle` / `forUsername`) – 1 unit (legacy `/c/` URLs try handle, then username: up to 2 units).
2. Page the uploads playlist with `playlistItems.list` – 1 unit per 50 videos.
3. Batch `videos.list` – 1 unit per 50 videos.
   Example: 1 channel × 50 videos with details ≈ 3 units. `search.list` is only used if `allowSearchFallback` is enabled for unresolved `/c/` URLs, and costs 100 units each.
   Quota used is logged and saved in the key-value store record `SUMMARY`.

### Output

Dataset records:

- `type: "channel"`: channelId, channelTitle, customUrl, subscriberCount (null if hidden), videoCount, viewCount.
- `type: "video"`: videoId, url, title, description, publishedAt, channelId, channelTitle, duration (ISO 8601) and durationSeconds, viewCount, likeCount, commentCount, tags, categoryId, definition, caption, liveBroadcastContent, wasLiveStream, probableShort (heuristic), thumbnail (highest resolution available).
- `type: "error"`: input, error (e.g. `channelNotFound`, `quotaExceeded`, `keyInvalid`), message. Quota/key errors stop the run gracefully.

### YouTube API terms

You use your own key and are bound by the YouTube API Services Terms of Service and Developer Policies (https://developers.google.com/youtube/terms/developer-policies). Notably: do not store API data (including statistics such as view/subscriber counts) for more than 30 days without refreshing or deleting it; do not aggregate API data across channels except as permitted; attribute YouTube as the source when displaying data.

# Actor input Schema

## `apiKey` (type: `string`):

Your own Google Cloud API key with YouTube Data API v3 enabled. Quota is consumed from your project (default 10,000 units/day).

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

Channel URLs (/@handle, /channel/UC..., /c/name, /user/name), @handles, or channel IDs (UC...).

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

Maximum number of uploads returned per channel (newest first).

## `publishedAfter` (type: `string`):

Only include videos published on/after this date (YYYY-MM-DD or ISO 8601).

## `publishedBefore` (type: `string`):

Only include videos published before this date (YYYY-MM-DD or ISO 8601).

## `includeVideoDetails` (type: `boolean`):

Call videos.list (1 unit per 50 videos) for duration, statistics, tags, category, definition, captions and live info.

## `skipShorts` (type: `boolean`):

Heuristic: skip videos with duration <= 60 s. Requires video details. Not an official Shorts flag; recent Shorts can be up to 3 minutes.

## `descriptionMaxLength` (type: `integer`):

Truncate descriptions to this many characters (0 = no truncation).

## `allowSearchFallback` (type: `boolean`):

Legacy /c/ custom URLs cannot always be resolved cheaply. If enabled, uses search.list (100 quota units per call) as a fallback.

## Actor input object example

```json
{
  "channels": [
    "@GoogleDevelopers"
  ],
  "maxVideosPerChannel": 50,
  "includeVideoDetails": true,
  "skipShorts": false,
  "descriptionMaxLength": 0,
  "allowSearchFallback": false
}
```

# Actor output Schema

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

No description

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

No description

# 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": [
        "@GoogleDevelopers"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("shadowell/youtube-channel-videos").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": ["@GoogleDevelopers"] }

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

```

## MCP server setup

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

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/65kwnazACbKwtd1hO/builds/1ma8CWFZ5o5Kkc4uQ/openapi.json
