FILE_STRUCTURE.md

File Structure

This document describes the organization of files and directories in the Ultimate Media Downloader project.


Directory Overview

Loading diagram...

Root Files

Main Application Files

FileLinesDescription
ultimate_downloader.py~3555Main application class and entry point
generic_downloader.py~1282Advanced downloader for sites with special requirements
cli_args.py~217Command-line argument parsing
logger.py~80Custom logging to suppress verbose output
youtube_scorer.py~1026Algorithm for ranking YouTube search results
platform_info.py~284Platform information display

Configuration Files

FileDescription
config.jsonApplication settings and preferences
requirements.txtPython package dependencies
setup.pyPackage installation configuration

Documentation Files

FileDescription
README.mdMain project documentation
LICENSEApache 2.0 license file
THIRD_PARTY_LICENSES.mdThird-party dependency licenses

Root Files Details

ultimate_downloader.py

The main application file containing:

  • UltimateMediaDownloader class
  • Platform detection logic
  • Download coordination
  • Progress display
  • Main entry point
# Key components
class UltimateMediaDownloader:
    def __init__(self, output_dir, verbose)
    def download(self, url, options)
    def detect_platform(self, url)
    def search_and_download_spotify_track(self, url)
    # ... many more methods

generic_downloader.py

Handles sites that need special treatment:

  • SSL/TLS bypass
  • Anti-bot protection bypass
  • Cloudflare bypass
  • Multiple fallback methods
  • Proxy rotation
class GenericSiteDownloader:
    def __init__(self, output_dir, verbose, proxies)
    def download(self, url)
    def _try_requests(self, url)
    def _try_cloudscraper(self, url)
    def _try_selenium(self, url)

cli_args.py

Command-line interface definition:

  • Argument parser configuration
  • Help text and examples
  • Option validation

logger.py

Custom logging system:

  • Suppresses verbose yt-dlp output
  • Counts warnings and errors
  • Shows summary after download

youtube_scorer.py

Intelligent video selection:

  • Scores YouTube search results
  • Considers title match, popularity, quality
  • Filters out unwanted content types

platform_info.py

Platform documentation:

  • List of supported platforms
  • Platform-specific features
  • Display formatting

Handlers Directory

Location: handlers/

Handler Files

FileLinesPlatform
__init__.py-Package initialization
spotify_handler.py~1212Spotify tracks, albums, playlists
apple_music_handler.py~1123Apple Music content
jiosaavn_handler.py~1712JioSaavn tracks, albums, playlists
gaana_handler.py~1140Gaana tracks, albums, playlists, artists
tumblr_handler.py~614Tumblr blogs and media
linkedin_handler.py~800LinkedIn posts and profiles
reddit_handler.py~900Reddit posts and user content
pinterest_handler.py~700Pinterest pins, boards, profiles
instagram_handler.py~1719Instagram posts, reels, stories, profiles
pornhub_handler.py~613Pornhub videos
xnxx_handler.py~500XNXX videos
xhamster_handler.py~500xHamster content
hianime_handler.py~600HiAnime series and videos
tiktok_handler.py~372TikTok videos
eporner_handler.py~961Eporner videos
hqporner_handler.py~701HQPorner videos
beeg_handler.py~901Beeg videos
four_k_wallpapers_handler.py~9504kwallpapers.com image browsing & download
amazon_music_handler.py~900Amazon Music content
audiomack_handler.py~900Audiomack songs and albums
bitchute_handler.py~900BitChute videos
boomplay_handler.py~900Boomplay tracks and albums
dailymotion_handler.py~900Dailymotion videos
flickr_handler.py~900Flickr photos and albums
kick_handler.py~900Kick VODs and streams
peertube_handler.py~900PeerTube videos
rumble_handler.py~900Rumble videos
ted_handler.py~900TED talks
trillertv_handler.py~900TrillerTV videos
twitch_handler.py~900Twitch streams and VODs
veoh_handler.py~900Veoh videos
vimeo_handler.py~900Vimeo videos
youtube_music_handler.py~924YouTube Music tracks and playlists

Handler Structure

Each handler follows this pattern:

class PlatformHandler:
    def __init__(self, downloader):
        """Initialize with reference to main downloader"""
        self.downloader = downloader
    
    def search_and_download(self, url, interactive=True):
        """Main entry point for downloading"""
        pass
    
    def _download_track(self, url):
        """Download single item"""
        pass
    
    def _download_playlist(self, url):
        """Download collection"""
        pass

Utils Directory

Location: utils/

Utility Files

FileLinesPurpose
__init__.py-Package initialization
utils.py~336Core utility functions
url_validator.py~199URL validation and support checking
file_manager.py~150File operations and organization
platform_utils.py~157Platform detection and configuration
browser_utils.py~200Browser automation utilities
ui_components.py~276Icons, messages, UI elements
ui_utils.py~100Rich console wrapper
progress_display.py~200Progress bars and status display

Key Utility Functions

From utils.py:

def sanitize_filename(filename)      # Remove invalid characters
def format_bytes(bytes_value)        # Human-readable file sizes
def format_duration(seconds)         # Human-readable durations
def detect_platform(url)             # Identify platform from URL
def is_playlist_url(url)             # Check if URL is a playlist
def load_config()                    # Load configuration file
def save_config(config)              # Save configuration file

From url_validator.py:

class URLValidator:
    def is_valid_url(url)            # Check URL format
    def check_url_support(url)       # Verify platform support

From ui_components.py:

class Icons:
    def get(name)                    # Get icon by name

class Messages:
    def success(text)                # Format success message
    def error(text)                  # Format error message
    def warning(text)                # Format warning message
    def info(text)                   # Format info message

Scripts Directory

Location: scripts/

Script Files

FilePlatformPurpose
install.shUnixInstall application
install.batWindowsInstall application
uninstall.shUnixRemove application
uninstall.batWindowsRemove application
setup.shUnixInitial setup
setup.batWindowsInitial setup
activate-env.shUnixActivate virtual environment
activate-env.batWindowsActivate virtual environment

Script Usage

# Install (macOS/Linux)
./scripts/install.sh

# Install (Windows)
scripts\install.bat

# Uninstall (macOS/Linux)
./scripts/uninstall.sh

# Uninstall (Windows)
scripts\uninstall.bat

Documentation

Location: documentations/

Documentation Files

FileDescription
ARCHITECTURE.mdSystem design and components
HANDLERS.mdPlatform handler documentation
INSTALLATION.mdInstallation instructions
USAGE.mdUsage guide with examples
CONFIGURATION.mdConfiguration options
PROJECT_OVERVIEW.mdProject summary
FILE_STRUCTURE.mdThis file

Cache and Generated Files

These files are created during operation:

umd/
    .cache/                  # Download cache
    __pycache__/            # Python bytecode cache
    handlers/__pycache__/   # Handler bytecode cache
    utils/__pycache__/      # Utils bytecode cache
    archive.txt             # Downloaded URL history
    *.egg-info/             # Package metadata (after install)

File Relationships

Loading diagram...

Summary

The project is organized into logical groups:

  1. Root: Main application files and configuration
  2. Handlers: Platform-specific download logic
  3. Utils: Shared helper functions and UI components
  4. Scripts: Installation and maintenance scripts
  5. Documentations: User and developer guides

This structure makes it easy to:

  • Find specific functionality
  • Add new features
  • Maintain existing code
  • Understand the project