youtube-download
YouTube Downloader
Download YouTube videos, audio, or subtitles using yt-dlp, with Chrome cookies for authenticated content.
Prerequisites
Uses uvx to run yt-dlp — no manual installation required.
Usage
When the user wants to download from YouTube: $ARGUMENTS
Instructions
Important: All yt-dlp commands use uvx yt-dlp. uvx handles installation and environment isolation automatically.
Step 1: Get video URL
If the user has not provided a video URL, ask them to provide one.
Supported sites include but are not limited to:
- YouTube (youtube.com, youtu.be)
- Bilibili (bilibili.com)
- Twitter/X (twitter.com, x.com)
- And other sites supported by yt-dlp
Step 2: Parse video info
Fetch video info with yt-dlp using Chrome cookies:
uvx yt-dlp --cookies-from-browser chrome -j "$VIDEO_URL" 2>/dev/null
Extract key info from the JSON output:
title: video titleduration: duration (seconds)formats: available format listsubtitles: available subtitlesautomatic_captions: auto-generated captions
Show the user:
- Video title
- Duration
- Available video qualities (e.g. 1080p, 720p, 480p)
- Available audio formats
- Available subtitle languages
If parsing fails, it may require login or the video is unavailable — inform the user of the specific reason.
Step 3: Ask user for download options
Warning: You MUST use AskUserQuestion to collect user preferences. Do not skip this step.
Use AskUserQuestion to collect the following:
-
Download content: What do you want to download?
- Options:
- "Video + Audio - Complete video file (Recommended)"
- "Audio only - MP3/M4A format"
- "Subtitles only - SRT/VTT format"
- "Video + Audio + Subtitles - Download all"
- Options:
-
Video quality (if downloading video): Choose video quality
- Options:
- "Best quality (Recommended)"
- "1080p - Full HD"
- "720p - HD"
- "480p - SD (save space)"
- "Lowest quality (smallest file)"
- Options:
-
Audio format (if downloading audio only): Choose audio format
- Options:
- "MP3 - Universal format (Recommended)"
- "M4A - High quality"
- "Best quality (keep original format)"
- Options:
-
Subtitle language (if subtitles available): Choose subtitle language
- Dynamically generate options based on parsed results
- Common options: Chinese, English, Japanese, auto-generated captions
-
Output path: Where to save?
- Default: current directory
- Allow custom path
Step 4: Build yt-dlp command
Build the yt-dlp command based on user choices:
Base options (always used)
--cookies-from-browser chrome # Use Chrome cookies
-o "%(title)s.%(ext)s" # Output filename format
--no-playlist # Don't download playlists
Video + Audio download
# Best quality
uvx yt-dlp --cookies-from-browser chrome -f "bestvideo+bestaudio/best" --merge-output-format mp4 -o "OUTPUT_PATH/%(title)s.%(ext)s" "URL"
# Specific resolution
uvx yt-dlp --cookies-from-browser chrome -f "bestvideo[height<=1080]+bestaudio/best[height<=1080]" --merge-output-format mp4 -o "OUTPUT_PATH/%(title)s.%(ext)s" "URL"
# 720p
uvx yt-dlp --cookies-from-browser chrome -f "bestvideo[height<=720]+bestaudio/best[height<=720]" --merge-output-format mp4 -o "OUTPUT_PATH/%(title)s.%(ext)s" "URL"
Audio only download
# MP3 format
uvx yt-dlp --cookies-from-browser chrome -x --audio-format mp3 --audio-quality 0 -o "OUTPUT_PATH/%(title)s.%(ext)s" "URL"
# M4A format
uvx yt-dlp --cookies-from-browser chrome -x --audio-format m4a --audio-quality 0 -o "OUTPUT_PATH/%(title)s.%(ext)s" "URL"
# Best quality (original format)
uvx yt-dlp --cookies-from-browser chrome -x --audio-quality 0 -o "OUTPUT_PATH/%(title)s.%(ext)s" "URL"
Subtitles only download
# Download all subtitles
uvx yt-dlp --cookies-from-browser chrome --write-subs --skip-download -o "OUTPUT_PATH/%(title)s.%(ext)s" "URL"
# Download specific language subtitles
uvx yt-dlp --cookies-from-browser chrome --write-subs --sub-langs "zh,en" --skip-download -o "OUTPUT_PATH/%(title)s.%(ext)s" "URL"
# Download auto-generated captions
uvx yt-dlp --cookies-from-browser chrome --write-auto-subs --sub-langs "zh,en" --skip-download -o "OUTPUT_PATH/%(title)s.%(ext)s" "URL"
# Convert to SRT format
uvx yt-dlp --cookies-from-browser chrome --write-subs --sub-format srt --convert-subs srt --skip-download -o "OUTPUT_PATH/%(title)s.%(ext)s" "URL"
Video + Subtitles together
uvx yt-dlp --cookies-from-browser chrome -f "bestvideo+bestaudio/best" --merge-output-format mp4 --write-subs --sub-langs "zh,en" --embed-subs -o "OUTPUT_PATH/%(title)s.%(ext)s" "URL"
Step 5: Execute download
- Show the full yt-dlp command to the user before execution
- Run the command and show download progress
- Report success or failure
Step 6: Verify output
After download completes:
ls -la "OUTPUT_PATH"
Report:
- Downloaded filename and size
- List subtitle files if downloaded
- Any warnings or issues
Troubleshooting
Login-required content:
- Ensure the user is logged in to the site in Chrome
- If still failing, suggest manually exporting cookies
Region-restricted:
- Inform the user they may need a proxy
- Try
--geo-bypassto bypass restrictions
Download failure:
- Check if the URL is correct
- Try updating yt-dlp:
uvx --refresh yt-dlp --version - Check network connectivity
More from maxgent-ai/maxgent-plugin
audio-transcribe
Speech-to-text transcription using Whisper with word-level timestamps. Use when users ask to transcribe audio or video to text, generate subtitles, or recognize speech.
51memory
Read long-term memory files to get historical context, code references, and error fix records. Use when user wants to read memory, get context, check history, avoid repeating errors.
12video-gen
AI video generation with text-to-video, image-to-video, and first/last frame control. Use when users ask to generate or create videos from text prompts or images.
10image-gen
AI image generation and editing. Use when users ask to generate, create, or draw images with AI, or edit and modify existing images.
6browser
Browser automation with persistent page state. Use when users ask to navigate websites, fill forms, take screenshots, extract web data, test web apps, or automate browser workflows. Trigger phrases include "go to [url]", "click on", "fill out the form", "take a screenshot", "scrape", "automate", "test the website", "log into", or any browser interaction request.
5media-understand
AI-powered media understanding and analysis for images, videos, and audio. Use when users ask to describe, analyze, summarize, or extract text (OCR) from media files.
5