A simple command‑line tool to download YouTube videos at a chosen resolution (including 4K) using yt‑dlp.
- Download a single video by URL.
- Choose a resolution (e.g.,
1080,1440,2160) or usebest(default). - Automatic fallback to the highest available resolution if the requested one is not present.
- Supports custom output directory.
- Merges video and audio into an MP4 file.
# Clone the repository (or copy the files into a folder)
git clone <repo‑url> yt-downloader
cd yt-downloader
# Install dependencies
pip install -r requirements.txtpython downloader.py <YouTube‑URL> [--resolution <height|best>] [--output-dir <path>]# Download the best quality available
python downloader.py https://www.youtube.com/watch?v=abc123
# Download a 1080p video
python downloader.py https://www.youtube.com/watch?v=abc123 --resolution 1080
# Download a 4K video (2160p) to a specific folder
python downloader.py https://www.youtube.com/watch?v=abc123 --resolution 2160 --output-dir ~/Videos- The script relies on
yt‑dlpwhich handles the heavy lifting of extracting video streams. - If the exact resolution is unavailable, the tool will automatically select the next lower resolution and print a warning.
- Ensure you have sufficient disk space for high‑resolution downloads.
MIT © 2026