CONFIGURATION.md

Configuration Guide

This document explains how to configure the Ultimate Media Downloader to suit your needs. The application uses a JSON configuration file and environment variables for different settings.


Configuration File

The main configuration file is config.json located in the project root directory.

File Location

umd/
    config.json        <-- Main configuration file
    ultimate_downloader.py
    ...

Configuration Structure

Loading diagram...

Configuration Sections

Spotify Settings

{
    "spotify": {
        "client_id": "",
        "client_secret": "",
        "enabled": false
    }
}
SettingTypeDescription
client_idstringSpotify API client ID
client_secretstringSpotify API client secret
enabledbooleanWhether Spotify API is enabled

To get Spotify API credentials:

  1. Go to Spotify Developer Dashboard
  2. Create a new application
  3. Copy the Client ID and Client Secret

Apple Music Settings

{
    "apple_music": {
        "enabled": false,
        "cookie_file": "",
        "media_user_token": ""
    }
}
SettingTypeDescription
enabledbooleanWhether Apple Music direct download is enabled
cookie_filestringPath to cookies file
media_user_tokenstringApple Music media user token

Download Settings

{
    "download": {
        "output_dir": "downloads",
        "format": "best",
        "audio_format": "mp3",
        "audio_quality": "320",
        "video_quality": "1080",
        "embed_thumbnail": true,
        "embed_metadata": true,
        "subtitles": false,
        "auto_subtitles": false,
        "all_subtitles": false,
        "subtitle_language": "en"
    }
}
SettingTypeDefaultDescription
output_dirstring"downloads"Default download directory
formatstring"best"Default video format
audio_formatstring"mp3"Default audio format
audio_qualitystring"320"Audio bitrate in kbps
video_qualitystring"1080"Default video quality
embed_thumbnailbooleantrueEmbed cover art in audio files
embed_metadatabooleantrueEmbed metadata in files
subtitlesbooleanfalseDownload subtitles
subtitle_languagestring"en"Subtitle language code

Proxy Settings

{
    "proxy": {
        "enabled": false,
        "http": "",
        "https": "",
        "socks5": ""
    }
}
SettingTypeDescription
enabledbooleanWhether to use proxy
httpstringHTTP proxy URL
httpsstringHTTPS proxy URL
socks5stringSOCKS5 proxy URL

Example proxy formats:

http://username:password@proxy.example.com:8080
socks5://127.0.0.1:1080

Authentication Settings

{
    "authentication": {
        "youtube": {
            "cookies_file": ""
        },
        "instagram": {
            "username": "",
            "password": ""
        },
        "facebook": {
            "cookies_file": ""
        }
    }
}

Using cookies allows downloading age-restricted or private content that you have access to.

Advanced Settings

{
    "advanced": {
        "concurrent_downloads": 3,
        "retry_attempts": 3,
        "timeout": 300,
        "rate_limit": null,
        "user_agent": "Mozilla/5.0 ...",
        "cookies_file": "",
        "archive_file": "archive.txt",
        "use_cache": true,
        "cache_dir": ".cache"
    }
}
SettingTypeDefaultDescription
concurrent_downloadsinteger3Max parallel downloads
retry_attemptsinteger3Retries on failure
timeoutinteger300Request timeout in seconds
rate_limitinteger/nullnullDownload speed limit in KB/s
user_agentstringChrome UABrowser user agent
archive_filestring"archive.txt"Downloaded URLs record
use_cachebooleantrueEnable caching
cache_dirstring".cache"Cache directory

UI Settings

{
    "ui": {
        "show_progress": true,
        "verbose": false,
        "quiet": false,
        "colors": true,
        "ascii_banner": true
    }
}
SettingTypeDefaultDescription
show_progressbooleantrueShow download progress
verbosebooleanfalseEnable verbose output
quietbooleanfalseSuppress output
colorsbooleantrueUse colored output
ascii_bannerbooleantrueShow ASCII art banner

Post-Processing Settings

{
    "post_processing": {
        "convert_format": false,
        "target_format": "mp4",
        "normalize_audio": false,
        "organize_files": true,
        "file_template": "%(title)s.%(ext)s"
    }
}
SettingTypeDescription
convert_formatbooleanConvert after download
target_formatstringTarget format for conversion
normalize_audiobooleanNormalize audio levels
organize_filesbooleanOrganize into folders
file_templatestringFilename template

Filter Settings

{
    "filters": {
        "min_duration": null,
        "max_duration": null,
        "date_after": null,
        "date_before": null,
        "min_views": null,
        "max_views": null
    }
}

These filters skip downloads that do not match criteria:

SettingTypeDescription
min_durationinteger/nullMinimum duration in seconds
max_durationinteger/nullMaximum duration in seconds
date_afterstring/nullOnly after date (YYYYMMDD)
date_beforestring/nullOnly before date (YYYYMMDD)
min_viewsinteger/nullMinimum view count
max_viewsinteger/nullMaximum view count

Environment Variables

Some settings can be configured through environment variables, which override config file settings.

Available Variables

VariablePurpose
SPOTIFY_CLIENT_IDSpotify API client ID
SPOTIFY_CLIENT_SECRETSpotify API client secret
APPLE_MUSIC_TOKENApple Music API token
APPLE_MUSIC_STOREFRONTApple Music region (default: "us")

Setting Environment Variables

On macOS and Linux, add to your shell profile:

# ~/.zshrc or ~/.bashrc
export SPOTIFY_CLIENT_ID="your_client_id"
export SPOTIFY_CLIENT_SECRET="your_client_secret"

Then reload:

source ~/.zshrc

On Windows, use System Properties or PowerShell:

[Environment]::SetEnvironmentVariable("SPOTIFY_CLIENT_ID", "your_client_id", "User")

Common Configurations

Configuration for Music Downloads

If you primarily download music:

{
    "download": {
        "audio_format": "flac",
        "audio_quality": "320",
        "embed_thumbnail": true,
        "embed_metadata": true
    },
    "post_processing": {
        "organize_files": true,
        "file_template": "%(artist)s - %(title)s.%(ext)s"
    }
}

Configuration for Video Archiving

If you download videos for archival:

{
    "download": {
        "format": "best",
        "video_quality": "2160",
        "subtitles": true,
        "all_subtitles": true
    },
    "advanced": {
        "archive_file": "archive.txt"
    }
}

Configuration for Slow Connections

If you have limited bandwidth:

{
    "download": {
        "video_quality": "720"
    },
    "advanced": {
        "concurrent_downloads": 1,
        "rate_limit": 500,
        "retry_attempts": 5
    }
}

Configuration with Proxy

If you need to use a proxy:

{
    "proxy": {
        "enabled": true,
        "https": "http://proxy.example.com:8080"
    }
}

Summary

The configuration system allows you to customize:

  • Default download settings
  • Audio and video quality preferences
  • Proxy and authentication
  • UI appearance
  • Post-processing behavior
  • Content filters

Most users will not need to change the defaults, but power users can fine-tune every aspect of the application's behavior.

For usage instructions, see the Usage Guide.