# YouTube Thumbnail Downloader (`apilab/youtube-thumbnail-downloader`) Actor

Extract and download high-resolution YouTube video thumbnails (HD 1280x720, SD, HQ) or get thumbnail image URLs and metadata.

- **URL**: https://apify.com/apilab/youtube-thumbnail-downloader.md
- **Developed by:** [Apilab](https://apify.com/apilab) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.10 / 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 Thumbnail Downloader

Download high-resolution YouTube video thumbnails in HD (1080p/720p `maxresdefault`), Standard Definition (`sddefault`), High Quality (`hqdefault`), and more.

Supports all YouTube URL formats (standard watch URLs, YouTube Shorts, embeds, shortened `youtu.be` links, and raw 11-character video IDs). Download images directly into the Apify Key-Value Store or extract direct image CDN URLs and metadata to your dataset.

***

### ✨ Features

- **Highest Available Quality (HD)**: Automatically fetches the maximum resolution thumbnail (`maxresdefault`, 1280x720) whenever available.
- **Intelligent Quality Cascade**: If maximum resolution is not available for older or lower-resolution videos, it automatically cascades to the next best available quality (`sddefault` -> `hqdefault` -> `mqdefault` -> `default`).
- **All URL Formats Supported**:
  - `https://www.youtube.com/watch?v=VIDEO_ID`
  - `https://youtu.be/VIDEO_ID`
  - `https://www.youtube.com/shorts/VIDEO_ID`
  - `https://www.youtube.com/embed/VIDEO_ID`
  - `https://www.youtube.com/live/VIDEO_ID`
  - Direct 11-character video IDs: `VIDEO_ID`
- **Key-Value Store Image Storage**: Save JPEG thumbnail files directly to the Apify Key-Value Store for one-click browser preview and download.
- **Comprehensive Resolution Links**: Generates direct links for all standard YouTube thumbnail resolutions in each dataset record.
- **Batch Processing**: Process dozens or hundreds of video URLs in a single run.

***

### 📥 Input

The Actor accepts the following input parameters:

| Field | Type | Description | Default |
|---|---|---|---|
| `urls` | Array of strings | List of YouTube video URLs, shorts URLs, or 11-character video IDs. | `["https://www.youtube.com/watch?v=dQw4w9WgXcQ"]` |
| `preferredQuality` | String (select) | Preferred thumbnail quality: `maxresdefault`, `sddefault`, `hqdefault`, `mqdefault`, or `default`. | `"maxresdefault"` |
| `downloadToStore` | Boolean | Whether to download the thumbnail image into the Key-Value Store. | `true` |

#### Input Example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "https://youtu.be/jNQXAC9IVRw",
    "https://www.youtube.com/shorts/kJQP7kiw5Fk"
  ],
  "preferredQuality": "maxresdefault",
  "downloadToStore": true
}
```

***

### 📤 Output

Each processed video is stored as a record in the default Apify Dataset.

#### Dataset Output Example

```json
{
  "videoId": "dQw4w9WgXcQ",
  "inputUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "success": true,
  "quality": "maxresdefault",
  "width": 1280,
  "height": 720,
  "thumbnailUrl": "https://img.youtube.com/vi/dQw4w9WgXcQ/maxresdefault.jpg",
  "fileSizeBytes": 65324,
  "keyValueStoreKey": "THUMBNAIL_dQw4w9WgXcQ.jpg",
  "keyValueStoreUrl": "https://api.apify.com/v2/key-value-stores/<STORE_ID>/records/THUMBNAIL_dQw4w9WgXcQ.jpg",
  "allThumbnails": {
    "maxresdefault": "https://img.youtube.com/vi/dQw4w9WgXcQ/maxresdefault.jpg",
    "sddefault": "https://img.youtube.com/vi/dQw4w9WgXcQ/sddefault.jpg",
    "hqdefault": "https://img.youtube.com/vi/dQw4w9WgXcQ/hqdefault.jpg",
    "mqdefault": "https://img.youtube.com/vi/dQw4w9WgXcQ/mqdefault.jpg",
    "default": "https://img.youtube.com/vi/dQw4w9WgXcQ/default.jpg"
  },
  "error": null
}
```

#### Key-Value Store

When `downloadToStore` is `true`, each thumbnail image is saved as `THUMBNAIL_<videoId>.jpg` in your default Key-Value Store with `image/jpeg` content type. You can preview and download the JPEG images directly in the Apify Console under the **Storage -> Key-value store** tab.

***

### 📐 Thumbnail Quality Levels

| Quality Code | Resolution | Aspect Ratio | Availability |
|---|---|---|---|
| `maxresdefault` | 1280 × 720 | 16:9 | HD/4K videos (falls back if unavailable) |
| `sddefault` | 640 × 480 | 4:3 | Standard Definition videos |
| `hqdefault` | 480 × 360 | 4:3 | Available for virtually all videos |
| `mqdefault` | 320 × 180 | 16:9 | Medium quality |
| `default` | 120 × 90 | 4:3 | Smallest thumbnail placeholder |

***

### 💡 Use Cases

- **Content Creation & Marketing**: Analyze competitor thumbnails, designs, colors, and typography.
- **Dataset Collection**: Gather training data for computer vision or image classification models.
- **Video Archiving & Catalogs**: Back up artwork and thumbnails for media management systems.
- **Social Media Management**: Automatically fetch high-res cover art for cross-platform sharing.

# Actor input Schema

## `urls` (type: `array`):

List of YouTube video URLs (watch, shorts, embed, share link) or 11-character video IDs to fetch thumbnails for.

## `preferredQuality` (type: `string`):

Preferred resolution for downloading the thumbnail. If the selected quality is unavailable (e.g. maxres on non-HD videos), it cascades to the next best available resolution.

## `downloadToStore` (type: `boolean`):

Download the thumbnail image file directly into the Key-Value Store so you can preview and download it in Apify.

## Actor input object example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=scwlR0QHGOk"
  ],
  "preferredQuality": "maxresdefault",
  "downloadToStore": true
}
```

# Actor output Schema

## `results` (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 = {
    "urls": [
        "https://www.youtube.com/watch?v=scwlR0QHGOk"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("apilab/youtube-thumbnail-downloader").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 = { "urls": ["https://www.youtube.com/watch?v=scwlR0QHGOk"] }

# Run the Actor and wait for it to finish
run = client.actor("apilab/youtube-thumbnail-downloader").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 '{
  "urls": [
    "https://www.youtube.com/watch?v=scwlR0QHGOk"
  ]
}' |
apify call apilab/youtube-thumbnail-downloader --silent --output-dataset

```

## MCP server setup

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

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/Z9qoQwSmw9HUsjyme/builds/hKEWNIafxJvs1OT8b/openapi.json
