Pillar Guide · Updated May 2026

How to Download YouTube Videos

The download part is easy. Everything around it is not. This guide covers yt-dlp, proxy layers, client path fallbacks, file size limits, and the tradeoffs between running it yourself and using a managed API.


By , builder, tinkerer, systems thinker. Ships SaaS products and publishes Apify actors. Published May 2026.


In This Guide


What You Need to Get Started

You need an Apify account (free tier works for small runs) and the URL of the YouTube video you want to download. No software installation. No browser extension. No local dependencies.

The YouTube Video Downloader actor runs on Apify's cloud infrastructure. It uses yt-dlp and ffmpeg internally, which means you get the same extraction power as running yt-dlp locally, without managing any local environment or keeping software updated.


Step-by-Step: Downloading a Video

The actor has three core input fields. Everything else is optional.

  1. Open the actor on Apify

    Go to the YouTube Video Downloader actor page and click "Try for free" or "Run" to open the input form.

  2. Add your YouTube URL

    In the urls field, add the video URL. Supported formats: https://www.youtube.com/watch?v=VIDEO_ID, https://youtube.com/shorts/VIDEO_ID, https://youtu.be/VIDEO_ID. Add multiple URLs for batch downloads.

  3. Set quality and format

    Choose quality: 360, 480, 720 (recommended default), or 1080. Choose format: default for MP4 video, mp3 for audio only. See the quality and format sections below for detailed guidance.

  4. Run and retrieve your files

    Click Run. When the run completes, open the dataset. Each successful item contains a downloadUrl link. Click any link to save the file to your device.


Choosing the Right Quality

Quality selection affects both file size and cost. The quality setting is a maximum, not a guarantee. If a video is only available at 720p, selecting 1080p returns 720p.

360p ($0.020/min)

Use for very long videos (1+ hour) where file size matters most. Audio research where visual quality is irrelevant. Archived content for reference purposes.

480p ($0.025/min)

Good balance for lecture content and educational videos 30 to 60 minutes long. Acceptable visual quality at roughly half the file size of 1080p.

720p HD ($0.030/min)

Recommended default for most use cases. Clear visuals for videos under 30 minutes, reliable for Shorts, and the best balance of quality and cost.

1080p Full HD ($0.040/min)

Best quality for short videos (under 10 minutes) where visual fidelity matters. Music videos, showcase content, archiving high-value recordings. Watch the 230 MB limit for longer content.

Rule of thumb: a 4-minute music video at 1080p is roughly 45 MB. The same video at 720p is roughly 25 MB. At 480p, roughly 15 MB. At 360p, roughly 8 MB.


MP4 vs MP3: When to Use Each

MP3 costs $0.010/min. 360p costs $0.020/min. The difference is output.

Choose MP4 when: you need the video track, you are archiving visual content, the video has on-screen text or visuals that matter, or you are distributing the content to others who need both audio and video.

Choose MP3 when: you only need the audio, you are producing a podcast or transcript, the video is a recording of a talk or interview, or you want to keep file sizes small for very long content. A 60-minute lecture as MP3 is typically under 100 MB. The same lecture at 480p video might exceed the 230 MB limit.


Downloading YouTube Shorts

Shorts use vertical aspect ratios and are typically under 3 minutes. The actor handles them identically to regular videos. Paste the Shorts URL directly: https://youtube.com/shorts/VIDEO_ID.

One important caveat: 1080p Shorts fail on the standard proxy path more often than regular 1080p videos. YouTube's bot detection is more aggressive on Shorts at the highest quality tier. If you need 1080p Shorts reliably, enable the residential proxy fallback (residentialProxyMode: "fallback"). Note that this adds a $0.05/MB surcharge when triggered. For most use cases, 720p Shorts on the standard path work without issue.


Batch Downloads

Add multiple URLs to the urls array in a single run. The actor processes each URL sequentially to avoid YouTube rate limits. This means run time scales linearly: five 4-minute videos at 720p will take roughly 5x the time of a single video, plus startup overhead.

For large batches, set a "Max total charge (USD)" cap on the Apify run dialog. This hard-caps the total charge for the run. The actor stops after hitting the cap, so you will not overspend on unexpectedly large files or an unexpectedly long video list.

Example batch cost: 10 videos averaging 5 minutes each at 720p = 50 minutes billed = $1.00 total. Set a $2.00 cap to allow headroom for longer-than-expected videos.


File Size Limits and Long Videos

The Apify key-value store has a 256 MB per-record limit. The actor uses a 230 MB limit to include a safety margin. For videos under 20 minutes at any quality, you are unlikely to hit this limit. For longer videos:

  • 20 to 40 minutes: use 720p or lower
  • 40 to 60 minutes: use 480p or lower
  • Over 60 minutes: use 360p, or extract audio with MP3 format

If you configure Cloudflare R2 storage (custom storage option), you bypass this limit entirely. Files are stored in R2 and the download URL in the dataset still points directly to the file. This is relevant for power users running large archives.


API Integration

The actor is callable programmatically from any language. The Apify client libraries (Node.js and Python) handle auth, run management, and dataset retrieval. Here is the Node.js pattern:

import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });

const run = await client.actor('marielisedev/youtube-video-downloader').call({
    urls: [
        { url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' }
    ],
    quality: '720',
    format: 'default'
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();

for (const item of items) {
    if (item.status === 'success') {
        console.log(item.title, item.downloadUrl, item.fileSize);
    }
}

The full product page includes Python and cURL examples. See the YouTube Video Downloader tool page for complete API documentation.


Troubleshooting Common Errors

"File size exceeds maximum"

The downloaded file is larger than 230 MB. Lower the quality (1080p to 720p, or 720p to 480p), or switch to MP3 format if you only need audio.

"Video unavailable" or "removed"

The video no longer exists on YouTube or was taken down by the uploader. Verify the URL works in your browser first. Failed downloads are not charged.

"Age-restricted video" error

Age-restricted content requires a logged-in YouTube session. This actor only downloads publicly accessible videos. There is no workaround for this limitation.

"Not a valid YouTube URL" error

Verify your URL contains youtube.com or youtu.be. Playlist URLs, YouTube Music URLs, and YouTube TV URLs are not supported. Each URL must point to a single video or Short.


FAQ

What is the best quality to use for long YouTube videos?

For videos longer than 20 minutes, 720p is the safest choice. At 1080p, a 30-minute video can exceed 300 MB, which is above the 230 MB file size limit per record in the Apify key-value store. Use 480p or 360p for videos over an hour. If you only need audio, MP3 produces much smaller files at any length.

How do I download YouTube Shorts?

Paste the Shorts URL directly into the urls input. The actor handles Shorts URLs identically to regular video URLs. For reliability, use 720p. Enable the residential proxy fallback only if you specifically need 1080p Shorts.

Can I extract just the audio from a YouTube video?

Yes. Set the format input to mp3. The actor downloads the video internally and extracts the audio track, producing an MP3 file. MP3 files are significantly smaller than video files and cost $0.010 per minute.

What YouTube URL formats are supported?

Three formats: https://www.youtube.com/watch?v=VIDEO_ID (standard), https://youtube.com/shorts/VIDEO_ID (Shorts), and https://youtu.be/VIDEO_ID (short links). Playlist URLs are not supported; each URL must point to a single video.

Why did my download fail?

Common causes: the file exceeded the 230 MB size limit (use lower quality or MP3), the video is private or age-restricted, the video was removed, or a regional block prevented access. Failed downloads are not charged.

Can I integrate this with my own code?

Yes. Use the Apify client for Node.js or Python, or call the REST API directly with cURL. Each run returns a dataset where every item has a downloadUrl, status, title, duration, file size, and quality. See the API section above for a Node.js example.