yabasha/download-youtube
Shell utility for downloading YouTube videos with yt-dlp
- Stars
- 0
- Forks
- 0
- Language
- Shell
- Updated
- 16h ago
§ Readme
Edit on GitHub ↗download-youtube is a shell wrapper around yt-dlp
and FFmpeg for downloading one or more YouTube videos.
Run it as download-youtube or yt after installation. It defaults to the
highest available resolution and saves to your current directory.
Why I made this
I wanted a quick way to download YouTube videos straight to my machine. The download sites I tried were full of ads and spam, and they often capped the resolution. I made this wrapper so I could paste a link into my terminal and get the best available video and audio without going through those sites.
Installation
-
If you haven't cloned the project, use the GitHub CLI from an account with access to the repository:
gh repo clone yabasha/download-youtube cd download-youtube -
From the repository root, run the installer:
./install.shThe installer checks for
yt-dlpand FFmpeg on yourPATH. If either is missing, it shows thebrew installcommand for just the missing tools. If Homebrew is available, answeryto let the installer run the command. If you decline, press Enter, or run without an interactive terminal, it stops without installing anything. Run the printed command manually and rerun./install.sh. Without Homebrew, use your system's package manager or the upstream installation instructions linked above.Once both tools are available, it sets up
download-youtubeandytin~/.local/binwithout overwriting a different command at either path. Node.js and npm are not required. -
If
~/.local/binis not already on yourPATH, run the following in your shell. Add the same line to~/.zshrcto keep it for future zsh sessions.export PATH="$HOME/.local/bin:$PATH" -
Verify both commands resolve and try listing formats without downloading:
download-youtube --help yt -F "https://youtu.be/jNQXAC9IVRw"
To use the script without installing it, run ./download-youtube.sh --help
from the repository root. The downloader does not install tools on its own,
and listing formats only requires yt-dlp.
Usage
With no URLs or batch file, the script prompts for one URL. To download multiple videos, pass each URL as its own argument. Quote each URL, especially if it contains query parameters.
yt
download-youtube "https://youtu.be/NE84ZYfnniU"
yt "https://youtu.be/jNQXAC9IVRw" "https://youtu.be/NE84ZYfnniU"
yt --batch-file urls.txt
yt -F "https://youtu.be/NE84ZYfnniU"
yt -r 1080p -d "$HOME/Downloads/AI Videos" "https://youtu.be/NE84ZYfnniU"
yt -k "https://youtu.be/NE84ZYfnniU"
For a batch file, put one URL per line without quotes:
https://youtu.be/jNQXAC9IVRw
https://youtu.be/NE84ZYfnniU
Empty lines and lines beginning with # are ignored. You can combine URL
arguments and batch files in the same command. Options such as -d and -r
apply to every video.
The script accepts YouTube watch URLs (youtube.com/watch?v=…), youtu.be
short links, and video URLs under /shorts/, /live/, or /embed/. Download
and format-listing modes select only the linked video, even if its URL includes
list=. Standalone playlist and channel URLs are rejected.
Options
-a FILE,--batch-file FILE: Read YouTube URLs from a text file, one per line.-F,--list-resolutions,--list-formats: List available formats and resolutions without downloading.-r HEIGHT,--resolution HEIGHT: Require an exact video height, such as1080or1080p. If it is unavailable, use-Fto see the available options.-d DIR,--destination DIR: Save toDIRinstead of the current directory. Quote paths that contain spaces.-k,--keep-video: Retain the separate video and audio files after merging. By default, only the merged file is kept.-h,--help: Show the built-in help.
Downloads are named Video title [VIDEO_ID].ext. Separate video and audio
downloads are merged into MKV. If no merge is needed, the extension depends
on the selected format. Existing files are not overwritten.
Git ignores files matching the downloader's output names, including partial
downloads, when they are saved inside this repository.
Tests
Run sh tests/playlist.sh from the repository root to check that both modes
select the linked video when a URL contains list=. This test uses local
stubs and runs offline.
From the repository root, run the live smoke test:
sh tests/smoke.sh
It downloads a short sample to a temporary folder, verifies that the file
contains video and audio with ffprobe, and removes the test files when it
exits. The test requires internet access, yt-dlp, and FFmpeg (including
ffprobe) on your PATH. To test a different short video, pass its URL as
an argument: sh tests/smoke.sh "YOUTUBE_URL".
Troubleshooting
yt: command not found: Check that~/.local/binis on yourPATH. If you skipped installation, run./download-youtube.shfrom the repository.- A dependency is missing: Run
yt-dlp --versionandffmpeg -versionto check that both are available in the same shell. - Requested format is unavailable: Run
yt -F "YOUTUBE_URL"and choose a listed video height, or omit-rto let the script pick automatically.
License
The script is free to use under the MIT license. Run it as-is or modify it to fit your needs.
§ Cite this project
For papers, blog posts, & AI referencesBashar Ayyash. (2026). yabasha/download-youtube [Computer software]. https://yabasha.dev/open-source/download-youtube