download-media
Download video, audio, playlists, clips or subtitles from a supported URL using yt-dlp. Use when the user wants media files on disk; use MarkItDown for text extraction and the loop skills for local loop editing.
- License 许可
- MIT
- 最近更新
- 2026-11-11
- Stars
- ★ 5
- Forks
- 0
01 前言 Front Matter
- name
- download-media
- license
- MIT
- metadata
- { "author": "coroboros", "sources": "github.com/yt-dlp/yt-dlp" }
- description
- Download video, audio, playlists, clips or subtitles from a supported URL using yt-dlp. Use when the user wants media files on disk; use MarkItDown for text extraction and the loop skills for local loop editing.
- when_to_use
- When the user has a media URL and wants the file on disk — video, audio-only, playlist, clip, or subtitles. Keywords — download video, yt-dlp, youtube, save video, extract audio, mp3, rip, playlist, clip, subtitles, 1080p. Skip when the user wants the transcript or text content (/markitdown), wants to loop or re-encode a local file (/video-loop, /audio-loop), or targets DRM-protected streaming services (Netflix, Disney+, Spotify…) — yt-dlp does not bypass DRM and neither does this skill.
- allowed-tools
- Bash(bash *) Bash(yt-dlp *) Bash(command *) Read
- argument-hint
- [-a] [-b] [-p] [-i] [-c A-B] [-u langs] [-r height] [-d dir] <url> [yt-dlp args]
- compatibility
- Requires bash and an installed yt-dlp CLI. FFmpeg is required for audio extraction, clipping and applicable merges; some extractors require additional documented runtimes or authentication.
02 资源文件 1
- 脚本scripts/download-media.sh4.9 KB
03 SKILL.md 正文
Download Media
Download video or audio from any yt-dlp-supported site using the yt-dlp CLI. The skill validates the input, composes the right flags for the intent, downloads under ~/.agents/output/<project>/download-media/<slug>/ (or a -d destination), and reports the final file paths — fully expanded, no tilde, no magic.
The deterministic work — install checks, slug derivation, destination, flag composition, final-path capture — happens in scripts/download-media.sh. The skill parses $ARGUMENTS, hands them to the script, and turns the script's RESULT: lines into a human report.
Scope
Personal and authorized use: public content, the user's own uploads, Creative Commons and licensed material. yt-dlp cannot bypass DRM and this skill never attempts to; decline requests to rip paid streaming catalogs (Netflix, Disney+, Spotify…) or to evade a site's paywall. Downloading may still be restricted by a site's terms of service and local copyright law — when a request is plainly about piracy, say so and stop.
Install
brew install yt-dlp # macOS
pipx install yt-dlp # any platform
brew install ffmpeg # strongly recommended — merging, mp3 extraction, clipping
Binaries for other setups: yt-dlp releases. For full YouTube support yt-dlp also wants a JavaScript runtime (deno recommended) — see the EJS wiki. Extractors break when sites change; a failing download is often fixed by updating: brew upgrade yt-dlp or pipx upgrade yt-dlp.
Parameters
| Flag | Default | Effect |
|---|---|---|
-a |
off | Audio only, mp3 (yt-dlp preset -t mp3; needs ffmpeg; rejects the video flags -r/-b) |
-b |
off | Best native quality — skip the mp4 compatibility preset |
-p |
off | Full playlist into a <playlist title>/ subfolder, files named NNN - title [id].ext (default: single video) |
-i |
off | Inspect only — list available formats, no download; wins over the download flags |
-c A-B |
— | Clip a time range, e.g. -c 10:15-12:30 (needs ffmpeg) |
-u <langs> |
— | Subtitles as sidecar files, e.g. -u "en.*,fr" (includes auto-generated) |
-r <height> |
— | Cap resolution, e.g. -r 1080 |
-d <dir> |
convention path | Destination directory |
Everything after the URL passes to yt-dlp verbatim — the escape hatch to the full CLI (see Recipes).
Default download: -t mp4 preset — h264/aac preferred, remuxed to mp4, plays everywhere. -b keeps yt-dlp's native best (often webm/mkv, higher fidelity, less compatible).
Workflow
-
Resolve the media URL from arguments or unambiguous session context. Ask only when it is missing or ambiguous.
-
Run the helper:
$SKILL_DIR= this skill's folder —${CLAUDE_SKILL_DIR}in Claude Code, the directory containing this SKILL.md elsewhere.bash "$SKILL_DIR"/scripts/download-media.sh -a 'https://example.com/watch?v=123&list=456'Parse arguments as data and quote each URL, path and flag value separately. Never splice raw
$ARGUMENTSinto shell code or useeval; URL metacharacters such as&must remain literal. -
The script emits
RESULT: key=valuelines — onepathper downloaded file, thenfiles,dest,slug(order not guaranteed; parse by key). With-iit prints yt-dlp's format table instead. -
Parse the
RESULT:lines and produce the report below. -
ERR: yt-dlp not installed(exit 127) orERR: -a and -c need ffmpeg(exit 3) → print the matching command from## Installand stop. Never auto-install on the user's behalf. -
Any other
ERR:(exit 2 — missing or non-URL input, unknown flag, missing flag value, invalid-r, conflicting flags) → relay the message verbatim and stop. A non-zero exit withRESULT:lines means a partial playlist success — report the downloaded files and the failure. A yt-dlp extraction failure → surface its stderr and suggest updating yt-dlp first (see Install).
Output
downloaded: <n> file(s) → <dest>
<path> # one line per file
Subtitle sidecars (-u) sit next to the media file but are not listed in RESULT: lines — mention they are in dest.
Examples
/download-media https://youtu.be/dQw4w9WgXcQ # video, mp4, best compatible
/download-media -a https://youtu.be/dQw4w9WgXcQ # mp3
/download-media -r 1080 <url> # cap at 1080p
/download-media -p <playlist-url> # whole playlist
/download-media -c 10:15-12:30 <url> # clip a segment
/download-media -u "en.*" <url> # video + English subtitles
/download-media -i <url> # list formats, download nothing
/download-media -d ~/Downloads <url> # custom destination
/download-media <url> --embed-thumbnail --embed-metadata # passthrough after the URL
Recipes — passthrough after the URL
| Intent | Append after the URL |
|---|---|
| Logged-in / member content | --cookies-from-browser firefox (or chrome, safari…) |
| Strip sponsor segments | --sponsorblock-remove sponsor (needs ffmpeg) |
| Incremental playlist sync | --download-archive <dir>/archive.txt |
| Split by chapters | --split-chapters |
| Embed thumbnail + metadata | --embed-thumbnail --embed-metadata |
| Only playlist items 3–7 | -I 3:7 (with -p) |
| Frame-accurate clip cuts | --force-keyframes-at-cuts (with -c; slow, re-encodes) |
| Gentle on rate limits | -t sleep (preset: spaced requests) |
| Site needs TLS impersonation | --extractor-args per site, or install curl_cffi |
Compose other yt-dlp flags the same way when an intent is not covered — the full option surface is yt-dlp --help.
Notes
- Final paths are captured, not guessed — the script uses
--print-to-file after_move:filepathso the reported paths are the real ones after merge/remux (--printwould silence download progress). - Playlist URLs holding a
v=too (watch-page URLs) download the single video by default;-pswitches to the whole playlist. - Unavailable playlist entries don't lose the run — yt-dlp skips them and exits non-zero; the script still reports every downloaded file, then propagates the exit code.
-ctakes a time range only (START-END,HH:MM:SSor seconds). Chapter-regex sections go through passthrough:--download-sections "intro".- Custom
-ooutput templates passed through work, but an absolute-omakes yt-dlp ignore the destination dir (-P) — prefer-dfor relocation. - No silent overwrites — yt-dlp skips already-downloaded files by default and the slug-namespaced destination keeps runs predictable.
Why the wrapper
yt-dlp is already a superb CLI; this skill exists to (a) put downloads under the repo's global output convention with the final paths reported deterministically, (b) translate "get me the audio" into the right preset without the user remembering -t mp3 vs -x --audio-format, and (c) keep the full flag surface reachable through verbatim passthrough instead of re-wrapping ~200 options.
04 同仓库更多 Skills
foo
Fixture skill for repo-kind classifier tests.
foo
Fixture for compound skills + npm tooling detection.
write-clear-readme
Author, restructure, audit or polish a project README for clarity and scannability. Reads repository truth, preserves anchors and code, and verifies rendering. Explicit author/polish requests apply local changes; audit/propose stays read-only. Use for README creation, wording, structure and navigation, including skill collections and CLI/SDK docs.
video-loop
Prepare a background video loop for a website with optional crossfade, MP4/WebM encoding and poster extraction. Use for loop joins or web delivery of an existing clip.
ultrapex
Adaptive implementation when the user explicitly selects /ultrapex or asks for this adaptive workflow. Establish accepted outcomes, implement, and verify the final result. Generic implementation requests use /apex; use /forge for decisions only and /oneshot for small focused changes.
suno-produce
Create and revise Suno v5.5 prompt artifacts from a song, track or album brief. Produces TRACK.md, ALBUM.md for explicit multi-track work, and optional ARTIST.md identity. Validates prompt fields and preserves supplied lyrics. Artifact-only; audio generation stays in Suno. Pure lyric writing and audio post-production use other skills.