# puyodead1/udemy-downloader architecture

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

- Interactive diagram: https://gitdiagram.com/puyodead1/udemy-downloader
- Repository: https://github.com/puyodead1/udemy-downloader

## Overview

This is a command-line Udemy course downloader. The user supplies a course URL and authentication material; the CLI configures a Udemy client, retrieves course information and curriculum, then processes the course into local output. Documented options include DRM video handling, captions, assets, quizzes and assignments, caching, and video encoding. The excerpts show the CLI orchestration, HTTP session, and selected media utilities; many download and parsing internals in Udemy.py are unsampled, so links for those capabilities rely on README documentation.

Main entry points: [`udemy_downloader/Udemy.py`](https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Udemy.py) (Udemy client), [`udemy_downloader/main.py`](https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/main.py) (CLI orchestration), [`udemy_downloader/Session.py`](https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Session.py) (HTTP session), [`udemy_downloader/UdemyAuth.py`](https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/UdemyAuth.py) (Bearer auth)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Command-line entry"]
  node_cli["CLI orchestration<br/>[main.py]"]
end

subgraph group_access["Udemy access"]
  node_client["Udemy client<br/>[Udemy.py]"]
  node_auth["Bearer auth<br/>[UdemyAuth.py]"]
  node_session["HTTP session<br/>[Session.py]"]
end

subgraph group_course["Course processing"]
  node_courseinfo["Course information<br/>[Udemy.py]"]
  node_curriculum["Curriculum processing<br/>[Udemy.py]"]
  node_cache["Course cache<br/>[Udemy.py]"]
end

subgraph group_downloads["Download outputs"]
  node_video["Lecture video download<br/>[Udemy.py]"]
  node_drm["DRM handling<br/>[Udemy.py]"]
  node_captions["Caption download<br/>[Udemy.py]"]
  node_assets["Lecture assets<br/>[Udemy.py]"]
  node_activities["Quizzes and assignments<br/>[Udemy.py]"]
  node_output["Course output<br/>[Udemy.py]"]
end

subgraph group_media["Media utilities"]
  node_widevine["Widevine utilities<br/>[utils.py]"]
  node_subtitles["VTT conversion<br/>[vtt_to_srt.py]"]
end

node_user(("User"))
node_udemy["Udemy service"]
node_ffmpeg["FFmpeg"]
node_aria2["aria2c"]
node_ytdlp["yt-dlp"]

node_user -->|"provides options"| node_cli
node_cli -->|"configures client"| node_client
node_cli -->|"runs pre-check"| node_client
node_cli -->|"loads keys"| node_client
node_cli -->|"visits and updates auth"| node_client
node_client -->|"uses session"| node_session
node_client -->|"uses auth"| node_auth
node_auth -->|"creates session"| node_session
node_session -.->|"sends requests"| node_udemy
node_cli -->|"fetches course info"| node_client
node_cli -->|"fetches content"| node_client
node_cli -->|"parses course data"| node_client
node_cli -->|"saves or loads cache"| node_client
node_client -->|"retrieves details"| node_courseinfo
node_client -->|"extracts curriculum"| node_curriculum
node_client -->|"stores course data"| node_cache
node_client -->|"downloads lectures"| node_video
node_client -->|"handles encrypted video"| node_drm
node_client -->|"downloads captions"| node_captions
node_client -->|"downloads assets"| node_assets
node_client -->|"downloads activities"| node_activities
node_client -->|"writes course files"| node_output
node_client -->|"uses DRM utilities"| node_widevine
node_client -->|"converts captions"| node_subtitles
node_video -->|"downloads streams"| node_ytdlp
node_video -->|"downloads segments"| node_aria2
node_video -->|"encodes video"| node_ffmpeg

click node_cli "https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/main.py"
click node_client "https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Udemy.py"
click node_auth "https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/UdemyAuth.py"
click node_session "https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Session.py"
click node_courseinfo "https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Udemy.py"
click node_curriculum "https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Udemy.py"
click node_cache "https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Udemy.py"
click node_video "https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Udemy.py"
click node_drm "https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Udemy.py"
click node_captions "https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Udemy.py"
click node_assets "https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Udemy.py"
click node_activities "https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Udemy.py"
click node_output "https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Udemy.py"
click node_widevine "https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/utils.py"
click node_subtitles "https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/vtt_to_srt.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_cli,node_user toneBlue
class node_client,node_auth,node_session toneAmber
class node_courseinfo,node_curriculum,node_cache toneMint
class node_video,node_drm,node_captions,node_assets,node_activities,node_output toneRose
class node_widevine,node_subtitles,node_udemy,node_ffmpeg,node_aria2,node_ytdlp toneIndigo
```

## Components

### Command-line entry

- [CLI orchestration](https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/main.py): `udemy_downloader/main.py`

### Udemy access

- [Udemy client](https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Udemy.py): `udemy_downloader/Udemy.py`
- [Bearer auth](https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/UdemyAuth.py): `udemy_downloader/UdemyAuth.py`
- [HTTP session](https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Session.py): `udemy_downloader/Session.py`

### Course processing

- [Course information](https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Udemy.py): `udemy_downloader/Udemy.py`
- [Curriculum processing](https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Udemy.py): `udemy_downloader/Udemy.py`
- [Course cache](https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Udemy.py): `udemy_downloader/Udemy.py`

### Download outputs

- [Lecture video download](https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Udemy.py): `udemy_downloader/Udemy.py`
- [DRM handling](https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Udemy.py): `udemy_downloader/Udemy.py`
- [Caption download](https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Udemy.py): `udemy_downloader/Udemy.py`
- [Lecture assets](https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Udemy.py): `udemy_downloader/Udemy.py`
- [Quizzes and assignments](https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Udemy.py): `udemy_downloader/Udemy.py`
- [Course output](https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/Udemy.py): `udemy_downloader/Udemy.py`

### Media utilities

- [Widevine utilities](https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/utils.py): `udemy_downloader/utils.py`
- [VTT conversion](https://github.com/puyodead1/udemy-downloader/blob/main/udemy_downloader/vtt_to_srt.py): `udemy_downloader/vtt_to_srt.py`

### Other components

- **User**
- **Udemy service**
- **FFmpeg**
- **aria2c**
- **yt-dlp**

## Connections

- User → CLI orchestration: provides options (evidence: `README.md`)
- CLI orchestration → Udemy client: configures client (evidence: `udemy_downloader/main.py`)
- CLI orchestration → Udemy client: runs pre-check (evidence: `udemy_downloader/main.py`)
- CLI orchestration → Udemy client: loads keys (evidence: `udemy_downloader/main.py`)
- CLI orchestration → Udemy client: visits and updates auth (evidence: `udemy_downloader/main.py`)
- Udemy client → HTTP session: uses session (evidence: `udemy_downloader/Udemy.py`)
- Udemy client → Bearer auth: uses auth (evidence: `udemy_downloader/Udemy.py`)
- Bearer auth → HTTP session: creates session (evidence: `udemy_downloader/UdemyAuth.py`)
- HTTP session → Udemy service: sends requests
- CLI orchestration → Udemy client: fetches course info (evidence: `udemy_downloader/main.py`)
- CLI orchestration → Udemy client: fetches content (evidence: `udemy_downloader/main.py`)
- CLI orchestration → Udemy client: parses course data (evidence: `udemy_downloader/main.py`)
- CLI orchestration → Udemy client: saves or loads cache (evidence: `udemy_downloader/main.py`)
- Udemy client → Course information: retrieves details (evidence: `udemy_downloader/Udemy.py`)
- Udemy client → Curriculum processing: extracts curriculum (evidence: `udemy_downloader/Udemy.py`)
- Udemy client → Course cache: stores course data (evidence: `udemy_downloader/Udemy.py`)
- Udemy client → Lecture video download: downloads lectures (evidence: `README.md`)
- Udemy client → DRM handling: handles encrypted video (evidence: `README.md`)
- Udemy client → Caption download: downloads captions (evidence: `README.md`)
- Udemy client → Lecture assets: downloads assets (evidence: `README.md`)
- Udemy client → Quizzes and assignments: downloads activities (evidence: `README.md`)
- Udemy client → Course output: writes course files (evidence: `README.md`)
- Udemy client → Widevine utilities: uses DRM utilities (evidence: `udemy_downloader/Udemy.py`)
- Udemy client → VTT conversion: converts captions (evidence: `udemy_downloader/Udemy.py`)
- Lecture video download → yt-dlp: downloads streams (evidence: `README.md`)
- Lecture video download → aria2c: downloads segments (evidence: `README.md`)
- Lecture video download → FFmpeg: encodes video (evidence: `README.md`)
