agentleFS
yaniv-golanyaniv-golan/ytd-skill/skills/youtube-downloader/SKILL.md

youtube-downloader

Skill1 starsChanged 8 months agoMITView on GitHub

Download YouTube videos with interactive resolution and subtitle selection using yt-dlp. Use when the user wants to download a YouTube video, save a video from YouTube, get video subtitles/captions, or mentions youtube download, yt-dlp, video resolution, or SRT subtitles from YouTube.

  • Installs packages

33 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use agent-deep-links, helium-mcp and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • ComposioHQSkill

    agent-deep-links

    Build, validate, and troubleshoot deep links for Codex, Cursor, VS Code, Visual Studio, and similar tools. Use when users ask for clickable links (especially in Slack) that open threads, files, folders, or app settings.

    Also in 3 projects that use this

  • ComposioHQSkill

    helium-mcp

    Search real-time news with bias scoring, get live stock/ETF/crypto data with AI analysis, ML options pricing, balanced news synthesis, and meme search via the Helium MCP server.

    Also in 3 projects that use this

  • trendinuxSkill

    twitter-algorithm-optimizer

    Analyze and optimize tweets for maximum reach using Twitter's open-source algorithm insights. Rewrite and edit user tweets to improve engagement and visibility based on how the recommendation system ranks content.

    Also in 12 projects that use this

  • petestewartSkill

    datadog-logs

    Query Datadog logs via the Logs Search API v2. Use when the user asks to "check the logs", "search logs", "find errors in Datadog", "look up logs for", "show me production logs", "check for errors", "search Datadog", or any request involving log search, error investigation, or production debugging that requires Datadog log data.

    Also in 3 projects that use this

  • MicrosoftSkill

    deploy-pipeline

    Triggers a Power Platform Pipeline deployment run for a Power Pages solution. Selects a target stage, validates the package, optionally configures deployment settings (environment variables, connection references), then deploys and polls for completion. Use when asked to: "deploy pipeline", "run pipeline", "trigger deployment", "deploy to staging", "deploy to production", "run power platform pipeline", "deploy solution via pipeline", "promote solution", "push to staging", "push to production".

    Also in 3 projects that use this

  • +7 more from ComposioHQ

The file

Show its rules and text

We split this skill into the rules it gives an agent

19 rules. 0 are common, 14 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 31 edited versions we read keep these.

  • 14

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before doing anything else, silently check if both tools are available:

    line 17
  2. Distinctive:

    If anything is missing, install it automatically — no need to ask the user.

    line 24
  3. Very specific:

    If pip is not found, try pip3.

    line 31
  4. Very specific:

    If missing, install one silently: apt-get install -y nodejs 2>/dev/null || brew install node 2>/dev/null.

    line 37
  5. Distinctive:

    After installation, verify all tools work before proceeding.

    line 39
  6. Distinctive:

    Follow these steps in order when the user provides a YouTube URL.

    line 43
  7. Very specific:

    Run yt-dlp -F "URL" to get the format table.

    line 47
  8. Distinctive:

    Use AskUserQuestion to let the user pick.

    line 53
  9. Distinctive:

    Use AskUserQuestion to let the user choose:

    line 75
  10. Distinctive:

    If the user's preferred language is only available as auto-generated, inform them and ask if that's acceptable.

    line 84
  11. Distinctive:

    Before downloading, show the user a summary of their selections:

    line 88
  12. Distinctive:

    Use AskUserQuestion to confirm: "Start download?" with options "Yes (Recommended)" and "Change settings".

    line 93
  13. Very specific:

    Always add --convert-subs srt when downloading subtitles — YouTube serves VTT/srv3 natively, and SRT is more universally compatible.

    line 113
  14. Distinctive:

    Run the command and show the user the download progress.

    line 115
  15. Distinctive:

    After download completes, list the downloaded files with their sizes:

    line 119
  16. Very specific:

    Add --cookies-from-browser chrome (or firefox, edge, safari) to the yt-dlp command.

    line 147
  17. Distinctive:

    Write cookies to a Netscape cookie file:

    line 173
  18. Distinctive:

    When yt-dlp fails, parse its stderr and respond with actionable advice:

    line 192
  19. Distinctive:

    Do not show raw yt-dlp error output to the user.

    line 206

“Common” is measured: kept by at least 6 in 10 of the 31 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

YouTube Downloader

Downloads YouTube videos interactively — lists available resolutions, checks for subtitles, and lets the user choose exactly what to download.

Prerequisites (auto-install)

Before doing anything else, silently check if both tools are available:

yt-dlp --version 2>/dev/null; echo "yt-dlp:$?"
ffmpeg -version 2>/dev/null | head -1; echo "ffmpeg:$?"

If anything is missing, install it automatically — no need to ask the user. Both tools are pip-installable and require no sudo or system package manager:

pip install -U yt-dlp    # pure Python, works everywhere
pip install ffmpeg-static # pre-built ffmpeg binary, no sudo needed

If pip is not found, try pip3. If ffmpeg-static fails, try imageio[ffmpeg] as a fallback which bundles its own ffmpeg binary. As a last resort on macOS try brew install ffmpeg, on Linux try apt-get install -y ffmpeg (may need sudo — only then ask the user).

Also check for a JavaScript runtime — yt-dlp uses it for some format detection:

node --version 2>/dev/null || deno --version 2>/dev/null

If missing, install one silently: apt-get install -y nodejs 2>/dev/null || brew install node 2>/dev/null. This is optional — yt-dlp works without it but may warn or miss some formats.

After installation, verify all tools work before proceeding. Tell the user what was installed.

Workflow

Follow these steps in order when the user provides a YouTube URL.

Step 1: List available formats

Run yt-dlp -F "URL" to get the format table. Parse the output and present a summary to the user — do not dump the raw table. Group the results into:

  • Video+Audio (single files): list resolution, codec, and approximate size
  • Video-only: list resolution, codec, and approximate size
  • Audio-only: list quality, codec, and approximate size

Use AskUserQuestion to let the user pick. Offer sensible defaults:

OptionDescription
Best quality (Recommended)Best video + best audio, merged automatically
1080p MP4Cap at 1080p, force MP4 container
720p MP4Smaller file, good for mobile
Audio onlyBest audio, no video
CustomUser specifies resolution or format code

Step 2: Check for subtitles

Run:

yt-dlp --list-subs "URL" 2>&1

Parse the output and tell the user:

  • Which manual (creator-uploaded) subtitle languages are available
  • Which auto-generated caption languages are available
  • Whether no subtitles are available at all

Use AskUserQuestion to let the user choose:

OptionDescription
No subtitlesDownload video only
English SRT (Recommended)Download English subtitles, convert to SRT
All available languagesDownload all subtitle tracks as SRT
Specific language(s)User picks from the available list

If the user's preferred language is only available as auto-generated, inform them and ask if that's acceptable.

Step 3: Confirm and download

Before downloading, show the user a summary of their selections:

  • Video format and resolution
  • Subtitle choice (if any)
  • The full yt-dlp command that will be run

Use AskUserQuestion to confirm: "Start download?" with options "Yes (Recommended)" and "Change settings".

Construct the yt-dlp command based on user choices. Use these format selectors:

User choiceFormat selector
Best quality-f "bv*+ba/b"
1080p MP4-f "bv*[height<=1080][ext=mp4]+ba[ext=m4a]/b[ext=mp4]"
720p MP4-f "bv*[height<=720][ext=mp4]+ba[ext=m4a]/b[ext=mp4]"
Audio only-f "ba/b" --extract-audio --audio-format mp3

For subtitles, append these flags:

Subtitle choiceFlags
Manual subs--write-subs --sub-langs "LANG" --convert-subs srt
Auto-generated--write-auto-subs --sub-langs "LANG" --convert-subs srt
Both manual + auto--write-subs --write-auto-subs --sub-langs "LANG" --convert-subs srt
All languages--write-subs --write-auto-subs --sub-langs "all" --convert-subs srt

Always add --convert-subs srt when downloading subtitles — YouTube serves VTT/srv3 natively, and SRT is more universally compatible.

Run the command and show the user the download progress.

Step 4: Confirm results

After download completes, list the downloaded files with their sizes:

ls -lh FILENAME*

Tell the user:

  • The video file path and size
  • Any subtitle files downloaded
  • The actual resolution and codec of the downloaded video

Format Selector Reference

SelectorMeaning
bv*Best video (may include audio)
baBest audio-only
bBest single file
+Merge two streams
/Fallback if first unavailable
[height<=720]Filter by max resolution
[ext=mp4]Filter by container format

Authentication via Browser (for restricted videos)

Some videos require authentication: age-restricted, private, or members-only content. When yt-dlp reports an error like "Sign in to confirm your age", "Private video", or "Join this channel to get access", use this workflow:

On desktop (Claude Code, Cursor)

Add --cookies-from-browser chrome (or firefox, edge, safari) to the yt-dlp command. This reads cookies from the user's local browser profile. The user must be logged into YouTube in that browser.

In sandboxed environments (Cowork, cloud)

There's no local browser profile, so use Playwright to get cookies:

  1. Launch a browser and navigate to YouTube:
    Use browser_navigate to go to https://accounts.google.com
  2. Tell the user to log in. Wait for them to complete the Google login flow — use browser_snapshot to check if they've reached the YouTube homepage or their Google account page.
  3. Once logged in, extract cookies:

    Use browser_evaluate to run: JSON.stringify(await (async () => {
      const cookies = document.cookie.split('; ').map(c => {
        const [name, ...rest] = c.split('=');
        return { name, value: rest.join('='), domain: '.youtube.com' };
      });
      return cookies;
    })())

    Better approach — if the Playwright MCP exposes a cookies API, use that directly to get all cookies for .youtube.com and .google.com domains.

  4. Write cookies to a Netscape cookie file:

    # Netscape cookie file format (one line per cookie):
    # domain\tinclude_subdomains\tpath\tsecure\texpiry\tname\tvalue
    .youtube.com	TRUE	/	TRUE	0	COOKIE_NAME	COOKIE_VALUE

    Save to a temporary file, e.g., /tmp/yt-cookies.txt.

  5. Retry the yt-dlp command with --cookies /tmp/yt-cookies.txt.
  6. Clean up the cookie file after download completes.

What authentication CANNOT fix

DRM-protected content (rented/purchased movies, YouTube Premium originals) cannot be downloaded even with authentication. The video stream is encrypted. If yt-dlp reports a DRM error, inform the user that this content is not downloadable.

Error Handling

When yt-dlp fails, parse its stderr and respond with actionable advice:

Error patternMeaningAction
Sign in to confirm / not a botBot detectionTrigger the browser auth workflow above
Private videoVideo is privateTrigger browser auth; if already authenticated, tell user they lack access
Join this channelMembers-onlyTrigger browser auth; user must be a channel member
Video unavailableDeleted or removedInform user, nothing can be done
is not available in your countryGeo-restrictedSuggest VPN or --proxy URL
DRM / cannot decryptDRM-protectedTell user this content cannot be downloaded — the stream is encrypted
Requested format not availableFormat mismatchFall back to -f "bv*+ba/b" and inform user
ffmpeg not foundMissing ffmpegRun the prerequisite install step
WARNING: Unable to extract.*nsig / JS playerMissing JS runtimeInstall nodejs and retry

Do not show raw yt-dlp error output to the user. Translate it into a clear message with a next step.

Troubleshooting

Slow download: YouTube may throttle. Add --concurrent-fragments 4 for parallel fragment downloads.

Geo-restricted video: Requires a VPN or proxy. Use --proxy URL if the user provides one.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.