home / skills / openclaw / skills / yt-video-downloader

yt-video-downloader skill

/skills/wells1137/yt-video-downloader

This skill downloads YouTube videos and audio in multiple formats for offline viewing, playlists, or channel extraction to fit your needs.

npx playbooks add skill openclaw/skills --skill yt-video-downloader

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
2.7 KB
---
name: youtube-downloader
description: Download YouTube videos with customizable quality and format options. Use this skill when the user asks to download, save, or grab YouTube videos. Supports various quality settings (best, 1080p, 720p, 480p, 360p), multiple formats (mp4, webm, mkv), and audio-only downloads as MP3.
version: 1.0.0
metadata:
  openclaw:
    emoji: "📥"
    requires:
      bins:
        - python3
---

# YouTube Video Downloader

Download YouTube videos with full control over quality and format settings.

## Quick Start

The simplest way to download a video:

```bash
python scripts/download_video.py "https://www.youtube.com/watch?v=VIDEO_ID"
```

This downloads the video in best available quality as MP4 to `/mnt/user-data/outputs/`.

## Options

### Quality Settings

Use `-q` or `--quality` to specify video quality:

- `best` (default): Highest quality available
- `1080p`: Full HD
- `720p`: HD
- `480p`: Standard definition
- `360p`: Lower quality
- `worst`: Lowest quality available

Example:
```bash
python scripts/download_video.py "URL" -q 720p
```

### Format Options

Use `-f` or `--format` to specify output format (video downloads only):

- `mp4` (default): Most compatible
- `webm`: Modern format
- `mkv`: Matroska container

Example:
```bash
python scripts/download_video.py "URL" -f webm
```

### Audio Only

Use `-a` or `--audio-only` to download only audio as MP3:

```bash
python scripts/download_video.py "URL" -a
```

### Custom Output Directory

Use `-o` or `--output` to specify a different output directory:

```bash
python scripts/download_video.py "URL" -o /path/to/directory
```

## Complete Examples

1. Download video in 1080p as MP4:
```bash
python scripts/download_video.py "https://www.youtube.com/watch?v=dQw4w9WgXcQ" -q 1080p
```

2. Download audio only as MP3:
```bash
python scripts/download_video.py "https://www.youtube.com/watch?v=dQw4w9WgXcQ" -a
```

3. Download in 720p as WebM to custom directory:
```bash
python scripts/download_video.py "https://www.youtube.com/watch?v=dQw4w9WgXcQ" -q 720p -f webm -o /custom/path
```

## How It Works

The skill uses `yt-dlp`, a robust YouTube downloader that:
- Automatically installs itself if not present
- Fetches video information before downloading
- Selects the best available streams matching your criteria
- Merges video and audio streams when needed
- Supports a wide range of YouTube video formats

## Important Notes

- Downloads are saved to `/mnt/user-data/outputs/` by default
- Video filename is automatically generated from the video title
- The script handles installation of yt-dlp automatically
- Only single videos are downloaded (playlists are skipped by default)
- Higher quality videos may take longer to download and use more disk space

Overview

This skill downloads YouTube videos in multiple formats and qualities for offline use. It supports full videos, audio extraction, playlists, channels, subtitles, thumbnails, and custom filenames. It leverages yt-dlp and optionally ffmpeg for format conversion and merging. Use it to back up content, extract audio, or prepare offline media collections.

How this skill works

The skill runs yt-dlp commands to fetch video streams, choose formats, and save files using customizable output templates. For separate video and audio streams it uses ffmpeg to merge tracks when needed. It can list available formats, download ranges or entire playlists, embed subtitles and thumbnails, and maintain an archive file to skip already downloaded items.

When to use it

  • Save videos for offline viewing where streaming is not possible or reliable
  • Extract audio tracks or convert video to MP3/M4A for podcasts or music
  • Download entire playlists or channels for archiving or offline courses
  • Embed subtitles, thumbnails, and metadata for local playback
  • Limit bandwidth, resume interrupted downloads, or skip already-downloaded items

Best practices

  • Install and keep yt-dlp updated (pip install -U yt-dlp) and install ffmpeg for merging and conversions
  • Respect copyright, terms of service, and obtain permission where required
  • Use --download-archive to avoid duplicate downloads when processing playlists or channels
  • Prefer format selection filters (e.g., bestvideo[height<=1080]+bestaudio) to control file size and quality
  • Test -F to list formats before choosing a specific format ID; use output templates to organize files

Example use cases

  • Download a lecture playlist and rename files with playlist index for offline study
  • Extract highest-quality audio from a music video and embed cover art and metadata
  • Archive all recent uploads from a channel into a dated folder for backup
  • Download videos with embedded English auto-subtitles for transcription or learning
  • Limit download speed while fetching large files on a metered connection

FAQ

Do I need ffmpeg?

ffmpeg is required to merge separate video and audio streams and to convert audio formats like MP3. If you only download single-file formats, ffmpeg is optional.

How do I resume interrupted downloads?

Use the -c option (yt-dlp -c "VIDEO_URL") to continue incomplete downloads from where they left off.

How can I avoid re-downloading the same files?

Use --download-archive downloaded.txt with playlist or channel downloads; yt-dlp will skip entries listed in that file.