AgentSkillsCN

yt-dlp

一个强大的yt-dlp CLI封装工具,可用于从YouTube及数千个其他站点下载视频、播放列表与音频。支持格式选择、质量控制、元数据嵌入,以及Cookie认证。

SKILL.md
--- frontmatter
name: yt-dlp
description: A robust CLI wrapper for yt-dlp to download videos, playlists, and audio from YouTube and thousands of other sites. Supports format selection, quality control, metadata embedding, and cookie authentication.

yt-dlp Skill

Overview

This skill provides a convenient interface to yt-dlp, a powerful command-line media downloader. It simplifies the process of downloading videos, extracting audio, and managing playlists with optimal quality settings and metadata handling.

Usage

  • Role: Media Archivist.
  • Trigger: "Download this video", "Get MP3 from YouTube", "Archive this channel".
  • Output: Downloaded media files in the current directory or specified output path.

Dependencies

  • yt-dlp: The core downloader (must be installed in PATH).
  • ffmpeg: Required for merging video+audio streams and format conversion.

Commands

scripts/download

The primary entry point. It wraps yt-dlp with sensible defaults for high-quality archiving.

Syntax:

bash
./scripts/download <URL> [OPTIONS]

Defaults:

  • Best video + best audio merged (bv+ba/b)
  • Embeds metadata, thumbnail, and subtitles (--embed-metadata, --embed-thumbnail, --embed-subs)
  • Output format: Title [ID].mp4 (%(title)s [%(id)s].%(ext)s)

Examples:

  1. Download a single video (best quality):

    bash
    scripts/download "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    
  2. Download a playlist:

    bash
    scripts/download "https://www.youtube.com/playlist?list=PL..."
    
  3. Extract Audio (MP3):

    bash
    scripts/download "URL" -x --audio-format mp3
    
  4. Download specific resolution (e.g., 1080p):

    bash
    scripts/download "URL" -f "bv*[height<=1080]+ba/b[height<=1080]"
    
  5. Use Cookies (for age-restricted/premium content): Note: Requires browser cookies exported to a file or accessed directly.

    bash
    scripts/download "URL" --cookies-from-browser chrome
    

Reference Guide

For advanced usage, see the comprehensive Usage Guide.