Skip to content

bios1311/yt-downloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YouTube Video Downloader

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.


Features

  • 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)

How to Use

You can use this tool in two ways:

1. Run from Source

  1. Install Go (version 1.18+ recommended)
  2. Clone this repository:
    git clone <repo-url>
    cd yt-downloader
  3. Run the app:
    go run main.go

2. Download Prebuilt Binary

  • For Windows: Download ytdownloader.exe and place it in your desired folder.
  • For Linux: Download ytdownloader (if available).

Usage

You can run the app in two modes:

A. Interactive Mode

Just run the app without arguments:

./ytdownloader.exe
# or
go run main.go

You will be prompted to enter a YouTube video or playlist URL, and whether you want to bypass age restrictions (true/false).

B. Command-Line Flags

You can also provide arguments directly:

./ytdownloader.exe --vidurl <video_url>
./ytdownloader.exe --urlplay <playlist_url>
./ytdownloader.exe --bypass_age true

Flags:

  • --vidurl : Download a single video by URL
  • --urlplay : Download a playlist by URL
  • --bypass_age : Set to true to enable cookie mode for age-restricted content (default: false)

If both --vidurl and --urlplay are empty, the app will prompt you interactively.


Bypass Age Restrictions (Cookie Mode)

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.

How to Save Your Cookies

  1. Log in to YouTube in your browser.
  2. Open Developer Tools (F12), go to the Application tab, and find your YouTube cookies.
  3. Copy all cookies in name=value format (one per line) and save them to a file named cookie.yml in the app directory.
    • Example:
      SID=your_sid_cookie_value
      HSID=your_hsid_cookie_value
      ...
      
  4. When --bypass_age is 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.


Requirements

  • 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

Troubleshooting

  • If you see errors about cookies, double-check your cookie.yml format: each line should be name=value with 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.exe is present in the app directory and is executable.
  • For playlist downloads, the app downloads and converts videos in parallel for speed.

Example

Download a single video (with age restriction bypass):

./ytdownloader.exe --vidurl "https://www.youtube.com/watch?v=example" --bypass_age true

Download a playlist interactively:

./ytdownloader.exe
# Enter playlist URL when prompted
# Enter true/false for age restriction bypass

Demo

Demo coming soon!


Appendix


About

Download any playlist or any video from youtube

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages