# lucksander/media-downloader architecture

> Architecture diagram of the GitHub repository lucksander/media-downloader, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lucksander/media-downloader
- Repository: https://github.com/lucksander/media-downloader

## Overview

Media Downloader is a terminal application for downloading a user-provided media URL as MP4 video, MP3 audio, or FLAC audio. The workflow gathers a format and, where applicable, a quality choice, configures yt-dlp, reports progress, and saves output under downloads/. The single runtime file combines these stages rather than separating them into modules. README documents FFmpeg-backed merging and conversion; the source configures those postprocessors, but does not show their internal execution.

Main entry points: [`main.py`](https://github.com/lucksander/media-downloader/blob/main/main.py) (Download options)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Terminal interaction"]
  node_menu["Format menu<br/>[main.py]"]
  node_video_quality["Video quality<br/>[main.py]"]
  node_mp3_quality["MP3 quality<br/>[main.py]"]
  node_url["URL input<br/>[main.py]"]
end

subgraph group_download["Download and conversion"]
  node_download_config["Download options<br/>[main.py]"]
  node_yt_dlp["yt-dlp engine"]
  node_ffmpeg["FFmpeg processing"]
  node_progress["Progress display<br/>[main.py]"]
  node_error_handling["Error handling<br/>[main.py]"]
end

subgraph group_output["Output handling"]
  node_downloads_dir["Downloads folder<br/>[main.py]"]
end

node_user(("User"))

node_user -->|"chooses format"| node_menu
node_menu -->|"selects video"| node_video_quality
node_menu -->|"selects MP3"| node_mp3_quality
node_user -->|"chooses quality"| node_video_quality
node_user -->|"chooses bitrate"| node_mp3_quality
node_user -->|"provides URL"| node_url
node_video_quality -->|"sets format"| node_download_config
node_mp3_quality -->|"sets bitrate"| node_download_config
node_url -->|"download input"| node_yt_dlp
node_download_config -->|"configures"| node_yt_dlp
node_yt_dlp -->|"calls hook"| node_progress
node_download_config -->|"requests processing"| node_ffmpeg
node_yt_dlp -->|"saves output"| node_downloads_dir
node_yt_dlp -->|"runs within"| node_error_handling

click node_menu "https://github.com/lucksander/media-downloader/blob/main/main.py"
click node_video_quality "https://github.com/lucksander/media-downloader/blob/main/main.py"
click node_mp3_quality "https://github.com/lucksander/media-downloader/blob/main/main.py"
click node_url "https://github.com/lucksander/media-downloader/blob/main/main.py"
click node_download_config "https://github.com/lucksander/media-downloader/blob/main/main.py"
click node_progress "https://github.com/lucksander/media-downloader/blob/main/main.py"
click node_error_handling "https://github.com/lucksander/media-downloader/blob/main/main.py"
click node_downloads_dir "https://github.com/lucksander/media-downloader/blob/main/main.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_menu,node_video_quality,node_mp3_quality,node_url,node_user toneBlue
class node_download_config,node_yt_dlp,node_ffmpeg,node_progress,node_error_handling toneAmber
class node_downloads_dir toneMint
```

## Components

### Terminal interaction

- [Format menu](https://github.com/lucksander/media-downloader/blob/main/main.py): `main.py`
- [Video quality](https://github.com/lucksander/media-downloader/blob/main/main.py): `main.py`
- [MP3 quality](https://github.com/lucksander/media-downloader/blob/main/main.py): `main.py`
- [URL input](https://github.com/lucksander/media-downloader/blob/main/main.py): `main.py`

### Download and conversion

- [Download options](https://github.com/lucksander/media-downloader/blob/main/main.py): `main.py`
- **yt-dlp engine**
- **FFmpeg processing**
- [Progress display](https://github.com/lucksander/media-downloader/blob/main/main.py): `main.py`
- [Error handling](https://github.com/lucksander/media-downloader/blob/main/main.py): `main.py`

### Output handling

- [Downloads folder](https://github.com/lucksander/media-downloader/blob/main/main.py): `main.py`

### Other components

- **User**

## Connections

- User → Format menu: chooses format (evidence: `main.py`)
- Format menu → Video quality: selects video (evidence: `main.py`)
- Format menu → MP3 quality: selects MP3 (evidence: `main.py`)
- User → Video quality: chooses quality (evidence: `main.py`)
- User → MP3 quality: chooses bitrate (evidence: `main.py`)
- User → URL input: provides URL (evidence: `main.py`)
- Video quality → Download options: sets format (evidence: `main.py`)
- MP3 quality → Download options: sets bitrate (evidence: `main.py`)
- URL input → yt-dlp engine: download input (evidence: `main.py`)
- Download options → yt-dlp engine: configures (evidence: `main.py`)
- yt-dlp engine → Progress display: calls hook (evidence: `main.py`)
- Download options → FFmpeg processing: requests processing (evidence: `main.py`)
- yt-dlp engine → Downloads folder: saves output (evidence: `main.py`)
- yt-dlp engine → Error handling: runs within (evidence: `main.py`)
