Skip to content

lilaTrue/youtube_downloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

YouTube CLI Downloader

A complete and interactive Python script to download YouTube videos.

Features

  • ✅ High-quality YouTube video downloads
  • ✅ MP3 audio extraction
  • ✅ Resolution choice (360p, 480p, 720p, 1080p)
  • ✅ Interactive CLI interface with menu
  • ✅ Command-line arguments
  • ✅ Download progress display
  • ✅ Detailed video information before download
  • ✅ Robust error handling

Installation

Prerequisites

  • Python 3.6+
  • pip

Installing Dependencies

pip install yt-dlp

For audio extraction, FFmpeg is recommended (automatically installed by yt-dlp if needed).

Usage

Interactive Mode (Recommended)

python youtube_downloader.py --interactive
# or simply
python youtube_downloader.py

The interactive mode provides a menu with the following options:

  1. Download video (best quality)
  2. Download as MP3 audio
  3. Download with resolution choice
  4. List available formats
  5. Change output directory
  6. Exit

Command-line Usage

# Simple download
python youtube_downloader.py "https://www.youtube.com/watch?v=VIDEO_ID"

# MP3 audio download
python youtube_downloader.py -f audio "https://www.youtube.com/watch?v=VIDEO_ID"

# Specific resolution download
python youtube_downloader.py -f 720 "https://www.youtube.com/watch?v=VIDEO_ID"

# Specify output directory
python youtube_downloader.py -o "/path/to/directory" "https://www.youtube.com/watch?v=VIDEO_ID"

Options

  • url: YouTube URL to download (optional in interactive mode)
  • -f, --format: Download format
    • best: Best available quality (default)
    • audio: MP3 audio only
    • 360, 480, 720, 1080: Specific video resolution
  • -o, --output: Custom output directory
  • -i, --interactive: Launch interactive mode

Default Output Directory

By default, videos are downloaded to:

  • Linux/Mac: ~/Downloads/YouTube/
  • Windows: C:\Users\[USERNAME]\Downloads\YouTube\

Usage Examples

Example 1: Simple Download

python youtube_downloader.py "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

Example 2: Audio Only

python youtube_downloader.py -f audio "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

Example 3: Interactive Mode

python youtube_downloader.py -i

Advanced Features

List Available Formats

Use option 4 in interactive mode to see all available formats for a video.

Batch Downloads

The script can be called multiple times or integrated into a bash script for batch downloads.

Error Handling

The script automatically handles:

  • Invalid URLs
  • Unavailable videos
  • Network issues
  • Audio conversion errors
  • Insufficient permissions

Security

  • The script does not collect any personal data
  • URLs are processed locally only
  • No connection to third-party servers (except YouTube)

License

This project is provided as-is, without warranty.

Support

For issues or suggestions, first check:

  1. That yt-dlp is up to date: pip install --upgrade yt-dlp
  2. That Python 3.6+ is installed
  3. That the YouTube URL is valid and accessible

Author

Script created by Cline - Autonomous Developer

About

Download any video in youtube (CLI interactive mode)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages