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). - INLINECODE2 : Required for merging video+audio streams and format conversion.
Commands
scripts/download.sh
The primary entry point. It wraps
yt-dlp with sensible defaults for high-quality archiving.
Syntax:
CODEBLOCK0
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):
CODEBLOCK1
- 2. Download a playlist:
CODEBLOCK2
- 3. Extract Audio (MP3):
CODEBLOCK3
- 4. Download specific resolution (e.g., 1080p):
CODEBLOCK4
- 5. Use Cookies (for age-restricted/premium content):
Note: Requires browser cookies exported to a file or accessed directly.
CODEBLOCK5
Installation & Security
This skill relies on
yt-dlp and
ffmpeg being installed on the host system.
- - Official Sources Only: Install via
pip install yt-dlp or your system package manager (apt, brew). Avoid running curl scripts from untrusted sources. - Cookies: Use
--cookies-from-browser with caution. For autonomous agents, prefer exporting a cookies.txt file manually to limit access to your active browser session.
Reference Guide
For advanced usage, see the comprehensive
Usage Guide.
yt-dlp 技能
概述
本技能为强大的命令行媒体下载工具 yt-dlp 提供了便捷的接口。它简化了视频下载、音频提取和播放列表管理的过程,并自动优化画质设置与元数据处理。
使用方式
- - 角色:媒体归档员
- 触发词:下载这个视频、从YouTube提取MP3、归档这个频道
- 输出:下载的媒体文件将保存至当前目录或指定输出路径
依赖项
- - yt-dlp:核心下载工具(必须安装在系统PATH中)
- ffmpeg:用于合并视频+音频流及格式转换
命令
scripts/download.sh
主要入口脚本。它为高质量归档封装了 yt-dlp 的合理默认参数。
语法:
bash
./scripts/download.sh [选项]
默认参数:
- - 最佳视频+最佳音频合并(bv+ba/b)
- 嵌入元数据、缩略图和字幕(--embed-metadata、--embed-thumbnail、--embed-subs)
- 输出格式:标题 [ID].mp4(%(title)s [%(id)s].%(ext)s)
示例:
- 1. 下载单个视频(最佳画质):
bash
scripts/download.sh https://www.youtube.com/watch?v=dQw4w9WgXcQ
- 2. 下载播放列表:
bash
scripts/download.sh https://www.youtube.com/playlist?list=PL...
- 3. 提取音频(MP3):
bash
scripts/download.sh URL -x --audio-format mp3
- 4. 下载指定分辨率(例如1080p):
bash
scripts/download.sh URL -f bv*[height<=1080]+ba/b[height<=1080]
- 5. 使用Cookies(用于年龄限制/付费内容):
注意:需要将浏览器cookies导出为文件或直接访问。
bash
scripts/download.sh URL --cookies-from-browser chrome
安装与安全
本技能依赖主机系统已安装 yt-dlp 和 ffmpeg。
- - 仅使用官方源:通过 pip install yt-dlp 或系统包管理器(apt、brew)安装。避免运行来自不可信来源的curl脚本。
- Cookies:谨慎使用 --cookies-from-browser。对于自主代理,建议手动导出 cookies.txt 文件,以限制对当前浏览器会话的访问。
参考指南
高级用法请参阅完整的
使用指南。