# lewangdev/youtube-drive architecture

> Architecture diagram of the GitHub repository lewangdev/youtube-drive, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lewangdev/youtube-drive
- Repository: https://github.com/lewangdev/youtube-drive

## Overview

youtube-drive is a command-line tool and Python library for converting files to RGB video and optionally storing that video on YouTube. The main workflow encodes a file before upload, or downloads a selected YouTube video before decoding it back to a file. Local encode/decode commands also support optional AES encryption. The graph follows the documented capabilities; source excerpts show the CLI orchestration and codec implementation, but not the internals of the YouTube client libraries.

Main entry points: [`youtube_drive/main.py`](https://github.com/lewangdev/youtube-drive/blob/main/youtube_drive/main.py) (CLI orchestration), [`youtube_drive/youtube_codec.py`](https://github.com/lewangdev/youtube-drive/blob/main/youtube_drive/youtube_codec.py) (RGB video codec), [`youtube_drive/config.py`](https://github.com/lewangdev/youtube-drive/blob/main/youtube_drive/config.py) (Encryption defaults)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflows"]
  node_main["CLI orchestration<br/>[main.py]"]
end

subgraph group_codec["File video codec"]
  node_codec["RGB video codec<br/>[youtube_codec.py]"]
  node_config["Encryption defaults<br/>[config.py]"]
end

subgraph group_integrations["YouTube integrations"]
  node_auth["YouTube authentication"]
  node_uploader["YouTube uploader"]
  node_downloader["YouTube downloader"]
end

node_user(("User"))
node_input_file["Input file"]
node_video_file["Local video"]
node_output_file["Decoded file"]
node_youtube["YouTube"]

node_user -->|"runs command"| node_main
node_main -->|"encodes or decodes"| node_codec
node_codec -->|"reads defaults"| node_config
node_codec -->|"reads bytes"| node_input_file
node_codec -->|"writes or reads"| node_video_file
node_codec -->|"writes bytes"| node_output_file
node_main -->|"gets credentials"| node_auth
node_auth -->|"authorizes"| node_youtube
node_main -->|"uploads video"| node_uploader
node_uploader -->|"sends video"| node_youtube
node_main -->|"downloads video"| node_downloader
node_downloader -->|"fetches video"| node_youtube

click node_main "https://github.com/lewangdev/youtube-drive/blob/main/youtube_drive/main.py"
click node_codec "https://github.com/lewangdev/youtube-drive/blob/main/youtube_drive/youtube_codec.py"
click node_config "https://github.com/lewangdev/youtube-drive/blob/main/youtube_drive/config.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_main,node_user toneBlue
class node_codec,node_config toneAmber
class node_auth,node_uploader,node_downloader toneMint
class node_input_file,node_video_file,node_output_file,node_youtube toneIndigo
```

## Components

### CLI workflows

- [CLI orchestration](https://github.com/lewangdev/youtube-drive/blob/main/youtube_drive/main.py): `youtube_drive/main.py`

### File video codec

- [RGB video codec](https://github.com/lewangdev/youtube-drive/blob/main/youtube_drive/youtube_codec.py): `youtube_drive/youtube_codec.py`
- [Encryption defaults](https://github.com/lewangdev/youtube-drive/blob/main/youtube_drive/config.py): `youtube_drive/config.py`

### YouTube integrations

- **YouTube authentication**
- **YouTube uploader**
- **YouTube downloader**

### Other components

- **User**
- **Input file**
- **Local video**
- **Decoded file**
- **YouTube**

## Connections

- User → CLI orchestration: runs command
- CLI orchestration → RGB video codec: encodes or decodes
- RGB video codec → Encryption defaults: reads defaults
- RGB video codec → Input file: reads bytes
- RGB video codec → Local video: writes or reads
- RGB video codec → Decoded file: writes bytes
- CLI orchestration → YouTube authentication: gets credentials
- YouTube authentication → YouTube: authorizes
- CLI orchestration → YouTube uploader: uploads video
- YouTube uploader → YouTube: sends video
- CLI orchestration → YouTube downloader: downloads video
- YouTube downloader → YouTube: fetches video
