This is a simple, cross-platform CLI tool to download any YouTube video or playlist. It saves both the video (with audio) as .mp4 and the audio as .mp3 using ffmpeg.
- Download individual YouTube videos or entire playlists
- Converts video to audio (mp3) automatically
- Supports bypassing YouTube age restrictions using your own cookies
- Parallel and efficient downloads
- Windows and Linux support (Windows is primary; Linux builds in progress)
You can use this tool in two ways:
- Install Go (version 1.18+ recommended)
- Clone this repository:
git clone <repo-url> cd yt-downloader
- Run the app:
go run main.go
- For Windows: Download
ytdownloader.exeand place it in your desired folder. - For Linux: Download
ytdownloader(if available).
You can run the app in two modes:
Just run the app without arguments:
./ytdownloader.exe
# or
go run main.goYou will be prompted to enter a YouTube video or playlist URL, and whether you want to bypass age restrictions (true/false).
You can also provide arguments directly:
./ytdownloader.exe --vidurl <video_url>
./ytdownloader.exe --urlplay <playlist_url>
./ytdownloader.exe --bypass_age trueFlags:
--vidurl: Download a single video by URL--urlplay: Download a playlist by URL--bypass_age: Set totrueto enable cookie mode for age-restricted content (default: false)
If both --vidurl and --urlplay are empty, the app will prompt you interactively.
Some YouTube videos require you to be logged in or age-verified. To download these, enable cookie mode with --bypass_age true (or answer true when prompted). The app will use cookies from a file called cookie.yml.
- Log in to YouTube in your browser.
- Open Developer Tools (F12), go to the Application tab, and find your YouTube cookies.
- Copy all cookies in
name=valueformat (one per line) and save them to a file namedcookie.ymlin the app directory.- Example:
SID=your_sid_cookie_value HSID=your_hsid_cookie_value ...
- Example:
- When
--bypass_ageis enabled, these cookies will be used for all requests.
Note: An example cookie file is provided as
cookie.yml. Do not share your cookies with others.
- Windows OS (primary support) or Linux (builds in progress)
- Go (if running from source)
ffmpeg.exe(must be in the same directory as the app on Windows)- Sufficient disk space for downloads
- If you see errors about cookies, double-check your
cookie.ymlformat: each line should bename=valuewith no extra spaces or line breaks. - If you get
invalid byte '\r' in Cookie.Value, make sure your cookie file uses Unix line endings (LF) or that you have no trailing spaces. - If you see errors about ffmpeg, ensure
ffmpeg.exeis present in the app directory and is executable. - For playlist downloads, the app downloads and converts videos in parallel for speed.
Download a single video (with age restriction bypass):
./ytdownloader.exe --vidurl "https://www.youtube.com/watch?v=example" --bypass_age trueDownload a playlist interactively:
./ytdownloader.exe
# Enter playlist URL when prompted
# Enter true/false for age restriction bypassDemo coming soon!
- Built with kkdai/youtube
- Uses ffmpeg for audio extraction