A desktop application for downloading videos and audio from YouTube with a graphical user interface. The application allows users to download content in various quality settings and formats, providing flexibility for different use cases.
Video Downloads
- Download YouTube videos in different resolutions
- Support for multiple video quality options
- Automatic detection of available video formats
Audio Downloads
- Extract and download audio tracks from videos
- Convert audio to MP3 format
- Support for different audio quality settings
Combined Downloads
- Download video and audio separately and merge them automatically
- Uses FFmpeg for efficient merging
- Preserves quality during the merge process
User Interface
- Clean and intuitive graphical interface built with CustomTkinter
- Dark theme for comfortable viewing
- Real-time progress tracking with visual feedback
- Animated loading indicators
- Video thumbnail preview
- Auto-scrolling text labels for long titles
- Automatic retry mechanism for failed downloads
- Support for YouTube Shorts
- OAuth authentication for improved reliability
- Configurable output directory
- Download progress visualization with percentage display
- Detailed video information display (title, author, views, length, publish date)
- Multiple quality selection through sliders and dropdown menus
The application is structured into several Python modules, each handling specific functionality:
main.py The entry point of the application. Handles the main window initialization, YouTube API integration, and coordinates between different components. Manages thumbnail processing and image display.
YoutubeDownloader.py Core download functionality using the pytube library. Manages video and audio stream selection, download progress tracking, file merging with FFmpeg, and format conversion.
MainFrame.py Main application window and layout management. Contains the search interface, thumbnail display area, progress bar integration, and coordinates UI updates.
TabView.py Provides the tabbed interface for selecting download options. Handles three modes: video and audio together, video only, and audio only. Manages quality selection controls.
ProgressBar.py Custom progress bar implementation that tracks download progress, displays percentage completion, shows status messages, and handles audio conversion feedback.
Slider.py Custom slider widget for quality selection. Allows users to choose from available resolution or bitrate options with a smooth interface.
AnimatedFrame.py Provides animated transitions for frame elements to enhance the user experience.
AutoScrollLabel.py Custom label widget that automatically scrolls text horizontally when it exceeds the available width, useful for displaying long video titles.
GUI Framework
- customtkinter: Modern and customizable tkinter interface
- tkinter: Base GUI toolkit
- PIL (Pillow): Image processing and display
YouTube Integration
- pytube: YouTube video download and metadata extraction
- google-api-python-client: YouTube Data API for retrieving video information and thumbnails
Media Processing
- moviepy: Audio extraction and conversion
- FFmpeg (subprocess): Video and audio merging
- cv2 (OpenCV): Image processing for thumbnail cropping
Utilities
- requests: HTTP requests for thumbnail downloads
- threading: Asynchronous operations for downloads and UI updates
- proglog: Progress logging for download tracking
- numpy: Image data manipulation
When you paste a YouTube URL and click search, the application uses the YouTube Data API to fetch video metadata and thumbnails. The pytube library analyzes available streams and presents quality options through an intuitive tabbed interface.
During download, the application can handle three scenarios: downloading video only, audio only, or both separately. When downloading both, it retrieves the highest quality video and audio streams separately, then merges them using FFmpeg to create the final file.
Progress is tracked in real-time through a custom progress bar that shows percentage completion and current status. The interface remains responsive during downloads thanks to threading, and users can see the video thumbnail while selecting download options.
The application uses OAuth caching for YouTube authentication to improve reliability and avoid rate limiting. Downloaded files are saved to the media_downloads directory with proper naming and format handling.
The application requires a YouTube Data API key, which should be set as an environment variable:
YT-API=your_api_key_here
Downloads are saved to the media_downloads folder by default.
- Python 3.x
- FFmpeg (must be installed and available in system PATH)
- YouTube Data API key
- Internet connection
- Run the application by executing
main.py - Enter a YouTube URL in the search field
- Click the search button to load video information
- Select your preferred download option from the tabs (Video and audio, Only video, or Only audio)
- Choose the desired quality using the sliders
- Click the download button
- Wait for the download to complete - progress is shown in the progress bar
The downloaded files will be saved in the media_downloads directory.