Skip to main content

Interactive YouTube Downloader CLI powered by yt-dlp

Project description

ytdl - Interactive YouTube Downloader

Python Version PyPI version License: MIT Downloads GitHub stars CI yt-dlp

A feature-rich, interactive CLI for downloading YouTube videos and playlists with ease.

Built on top of yt-dlp with an intuitive menu system powered by questionary.

FeaturesInstallationQuick StartDocumentationContributing

✨ Features

  • 🎯 Interactive Menu System - Easy-to-use interface with questionary
  • 📋 Playlist Auto-Detection - Automatically detects and organizes playlists
  • Quick Default Download - One-click download with optimal settings
  • 🎨 Advanced Configuration - Fine-tune every aspect of your downloads
  • 📁 Smart Naming Templates - Multiple presets + custom template support
  • 🎵 Audio Extraction - Download and convert to MP3
  • 🖼️ Rich Post-Processing - Thumbnails, subtitles, metadata embedding
  • 🚀 SponsorBlock Integration - Automatically remove sponsors and ads
  • 🌍 Geo-Bypass & Proxy Support - Download region-restricted content
  • 📊 Real-time Progress - Live download progress and speed display

📦 Installation

From PyPI (Recommended)

pip install ytdl-interactive

From Source

# Clone the repository
git clone https://github.com/abd3lraouf/ytdl.git
cd ytdl

# Install in development mode
pip install -e .

Requirements

  • Python 3.9 or higher
  • FFmpeg (for video/audio processing)

Installing FFmpeg

macOS (Homebrew):

brew install ffmpeg

Ubuntu/Debian:

sudo apt update
sudo apt install ffmpeg

Windows (Chocolatey):

choco install ffmpeg

Or download from ffmpeg.org

🚀 Quick Start

Basic Usage

# Download a single video
ytdl https://www.youtube.com/watch?v=dQw4w9WgXcQ

# Download a playlist
ytdl "https://www.youtube.com/playlist?list=PLxxxxxx"

# Download from a channel
ytdl https://www.youtube.com/@channelname

Command-line Options

ytdl [URL]                    # Start interactive mode with URL
ytdl --version                # Show version information
ytdl --help                   # Display help message

📖 Usage Guide

Main Menu

After providing a URL, you'll see the main menu:

1. Quick Default Download (Recommended)
   └─ Downloads with optimal settings:
      - Best quality video + audio
      - Saved to ./downloads/
      - Auto-organized playlists

2. Advanced Download Settings
   └─ Customize every aspect:
      - Format selection
      - Output paths and naming
      - Post-processing options
      - Network settings

3. Exit

Quick Default Download

The quickest way to download with optimal settings:

  • Format: Best quality video + audio (automatically merged)
  • Output: ./downloads/
  • Single videos: Title.ext
  • Playlists: PlaylistName/001 - VideoTitle.ext

Example output structure:

downloads/
├── My Awesome Playlist/
│   ├── 001 - First Video.mp4
│   ├── 002 - Second Video.mp4
│   └── 003 - Third Video.mp4
└── Single Video Title.mp4

Advanced Settings

1. Download Type/Format

  • Video (Best Quality) - bestvideo*+bestaudio/best
  • Audio Only (MP3) - Extracts and converts to MP3 (192 kbps)
  • List Formats - View all available formats and select custom format codes

2. Output Path & Naming

Preset Templates:

Template Format Example
Default %(title)s.%(ext)s My Video.mp4
Rich Metadata %(upload_date)s - %(channel)s - %(title)s.%(ext)s 20231215 - Channel Name - My Video.mp4
Minimalist %(id)s.%(ext)s dQw4w9WgXcQ.mp4
Custom Your template Define your own!

Playlist Auto-Organization: All templates automatically organize playlists into subfolders with zero-padded indices.

Custom Template Variables:

%(title)s          - Video title
%(id)s             - Video ID
%(ext)s            - File extension
%(upload_date)s    - Upload date (YYYYMMDD)
%(channel)s        - Channel name
%(uploader)s       - Uploader name
%(playlist)s       - Playlist name
%(playlist_index)s - Video index in playlist
%(duration)s       - Video duration
%(view_count)s     - View count

3. Post-Processing Options

  • Embed Thumbnail - Embed video thumbnail in the file
  • Embed Subtitles - Download and embed subtitles (English/Arabic)
  • Add Metadata - Add rich metadata to the file
  • SponsorBlock - Automatically remove sponsor segments and ads

4. Networking Options

  • Proxy Support - Route downloads through a proxy
    http://proxy.example.com:8080
    socks5://proxy.example.com:1080
    
  • Geo-Bypass - Bypass geographic restrictions

💡 Examples

Download a single video with defaults

ytdl https://www.youtube.com/watch?v=dQw4w9WgXcQ
# Select: 1. Quick Default Download

Download playlist as MP3s

ytdl "https://www.youtube.com/playlist?list=PLxxxxxx"
# Select: 2. Advanced Settings
# → Select Download Type → Audio Only (MP3)
# → Start Download

Custom output with metadata

ytdl https://www.youtube.com/watch?v=VIDEO_ID
# Select: 2. Advanced Settings
# → Output Path → Select "Rich Metadata"
# → Post-Processing → Check all options
# → Start Download

Download with proxy

ytdl https://www.youtube.com/watch?v=VIDEO_ID
# Select: 2. Advanced Settings
# → Networking → Enter proxy URL
# → Start Download

🏗️ Project Structure

ytdl/
├── ytdl.py              # Main application
├── pyproject.toml       # Package configuration
├── requirements.txt     # Dependencies
├── README.md            # This file
├── LICENSE              # MIT License
└── .gitignore          # Git ignore rules

🤖 Automated Releases

This project uses automated versioning and CI/CD:

  • Automatic versioning via setuptools_scm (based on git tags)
  • Automated PyPI publishing on new releases
  • CI testing on all PRs and pushes
  • Release drafts auto-generated from commits

Creating a New Release

  1. Go to ActionsBump VersionRun workflow
  2. Select version type (patch/minor/major)
  3. Workflow automatically:
    • Creates git tag
    • Generates changelog
    • Creates GitHub release
    • Publishes to PyPI

See CONTRIBUTING.md for detailed release process.

🛠️ Development

Setup Development Environment

# Clone repository
git clone https://github.com/abd3lraouf/ytdl.git
cd ytdl

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install in development mode with dev dependencies
pip install -e ".[dev]"

Code Structure

# Main components:
DownloadConfig          # Configuration container
progress_hook()         # Real-time download progress
postprocessor_hook()    # Post-processing status
detect_playlist()       # Playlist detection
execute_download()      # Download execution
show_main_menu()        # Interactive menu system

Running Tests

# Install dev dependencies
pip install -e ".[dev]"

# Run tests (when available)
pytest

# Code formatting
black ytdl.py

# Type checking
mypy ytdl.py

🤝 Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Guidelines

  • Follow PEP 8 style guidelines
  • Add comments for complex logic
  • Update README for new features
  • Test thoroughly before submitting

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • yt-dlp - The powerful downloader this tool is built upon
  • questionary - Beautiful interactive prompts
  • All contributors and users of this project

⚠️ Disclaimer

This tool is for personal use only. Please respect copyright laws and YouTube's Terms of Service. Only download content you have permission to download.

🐛 Bug Reports & Feature Requests

Found a bug or have a feature request? Please open an issue on GitHub.

📮 Contact

🗺️ Roadmap

  • Configuration file support (~/.ytdlrc)
  • Download queue management
  • Resume interrupted downloads
  • Batch download from file
  • GUI wrapper (tkinter/PyQt)
  • Docker support
  • Download scheduler

Made with ❤️ by developers, for developers

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ytdl_interactive-1.1.0.tar.gz (25.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ytdl_interactive-1.1.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file ytdl_interactive-1.1.0.tar.gz.

File metadata

  • Download URL: ytdl_interactive-1.1.0.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ytdl_interactive-1.1.0.tar.gz
Algorithm Hash digest
SHA256 d341cf633d3cc99079c58d9335351db660b71877534165fb66bae03b16a7588f
MD5 8adfed6d1b6e326f70ab181237f1a057
BLAKE2b-256 5ed5eebd778e2ed89c7f45564c8cc57c3943b43c028142097c7ec3bb6f3649a0

See more details on using hashes here.

File details

Details for the file ytdl_interactive-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ytdl_interactive-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 60887f2562ff5a9ff38a5a6d889d34d253e9e9972a3ab97295cf4a2d84e5b4a6
MD5 529baea7928130dfab34986c14af5a81
BLAKE2b-256 c64df4000c71414451dbad023448f8f2fb7acb672896bd0e0b0ff2a3520a1e47

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page