# flz101/dl_coursera architecture

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

- Interactive diagram: https://gitdiagram.com/flz101/dl_coursera
- Repository: https://github.com/flz101/dl_coursera

## Overview

dl_coursera is a command-line Coursera course and specialization downloader. Users provide an enrolled course or specialization slug, cookies, and output options; the CLI validates access, crawls course structure and materials, gathers filesystem download tasks, downloads assets, and writes course playlists. The README also documents quiz inclusion, subtitle-language selection, and generated HTML for reading materials. The graph preserves these documented capabilities; some internal links rely on the supplied source index because not all runtime code was excerpted.

Main entry points: [`dl_coursera_run.py`](https://github.com/flz101/dl_coursera/blob/master/dl_coursera_run.py) (CLI workflow), [`dl_coursera/DLTaskGatherer.py`](https://github.com/flz101/dl_coursera/blob/master/dl_coursera/DLTaskGatherer.py) (Download task gatherer), [`dl_coursera/Crawler.py`](https://github.com/flz101/dl_coursera/blob/master/dl_coursera/Crawler.py) (Coursera crawler), [`dl_coursera/Downloader.py`](https://github.com/flz101/dl_coursera/blob/master/dl_coursera/Downloader.py) (Asset downloader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Command entry"]
  node_cli["CLI workflow<br/>[dl_coursera_run.py]"]
end

subgraph group_crawl["Course crawling"]
  node_courseware["Course models<br/>[define.py]"]
  node_crawler["Coursera crawler<br/>[Crawler.py]"]
  node_markup["CML conversion<br/>[markup.py]"]
end

subgraph group_prepare["Task preparation"]
  node_gatherer["Download task gatherer<br/>[DLTaskGatherer.py]"]
  node_tree["Output path tree<br/>[ExploringTree.py]"]
  node_resource["Bundled resources<br/>[__init__.py]"]
end

subgraph group_runtime["Download runtime"]
  node_scheduler["Task scheduler<br/>[TaskScheduler.py]"]
  node_downloader["Asset downloader<br/>[Downloader.py]"]
  node_misc["Runtime utilities<br/>[misc.py]"]
  node_dict["Dictionary models<br/>[MyDict.py]"]
end

node_user(("Downloader user"))
node_coursera{{"Coursera API"}}
node_output["Course output files"]
node_downloadnet{{"Asset network"}}

node_user -->|"supplies options"| node_cli
node_cli -->|"starts crawl"| node_crawler
node_crawler -->|"requests course data"| node_coursera
node_crawler -->|"builds models"| node_courseware
node_crawler -->|"converts CML"| node_markup
node_cli -->|"gathers tasks"| node_gatherer
node_gatherer -->|"builds output paths"| node_tree
node_gatherer -->|"renders supplements"| node_markup
node_gatherer -->|"loads bundled files"| node_resource
node_gatherer -->|"writes files"| node_output
node_cli -->|"runs task queue"| node_scheduler
node_cli -->|"starts downloads"| node_downloader
node_downloader -->|"fetches assets"| node_downloadnet
node_downloader -->|"saves assets"| node_output
node_courseware -->|"extends models"| node_dict
node_scheduler -->|"formats task details"| node_misc
node_cli -->|"writes crawl cache"| node_output

click node_cli "https://github.com/flz101/dl_coursera/blob/master/dl_coursera_run.py"
click node_courseware "https://github.com/flz101/dl_coursera/blob/master/dl_coursera/define.py"
click node_crawler "https://github.com/flz101/dl_coursera/blob/master/dl_coursera/Crawler.py"
click node_markup "https://github.com/flz101/dl_coursera/blob/master/dl_coursera/markup.py"
click node_gatherer "https://github.com/flz101/dl_coursera/blob/master/dl_coursera/DLTaskGatherer.py"
click node_tree "https://github.com/flz101/dl_coursera/blob/master/dl_coursera/lib/ExploringTree.py"
click node_resource "https://github.com/flz101/dl_coursera/blob/master/dl_coursera/resource/__init__.py"
click node_scheduler "https://github.com/flz101/dl_coursera/blob/master/dl_coursera/lib/TaskScheduler.py"
click node_downloader "https://github.com/flz101/dl_coursera/blob/master/dl_coursera/Downloader.py"
click node_misc "https://github.com/flz101/dl_coursera/blob/master/dl_coursera/lib/misc.py"
click node_dict "https://github.com/flz101/dl_coursera/blob/master/dl_coursera/lib/MyDict.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_courseware,node_crawler,node_markup toneAmber
class node_gatherer,node_tree,node_resource,node_coursera toneMint
class node_scheduler,node_downloader,node_misc,node_dict toneRose
class node_output,node_downloadnet toneIndigo
```

## Components

### Command entry

- [CLI workflow](https://github.com/flz101/dl_coursera/blob/master/dl_coursera_run.py): `dl_coursera_run.py`

### Course crawling

- [Course models](https://github.com/flz101/dl_coursera/blob/master/dl_coursera/define.py): `dl_coursera/define.py`
- [Coursera crawler](https://github.com/flz101/dl_coursera/blob/master/dl_coursera/Crawler.py): `dl_coursera/Crawler.py`
- [CML conversion](https://github.com/flz101/dl_coursera/blob/master/dl_coursera/markup.py): `dl_coursera/markup.py`

### Task preparation

- [Download task gatherer](https://github.com/flz101/dl_coursera/blob/master/dl_coursera/DLTaskGatherer.py): `dl_coursera/DLTaskGatherer.py`
- [Output path tree](https://github.com/flz101/dl_coursera/blob/master/dl_coursera/lib/ExploringTree.py): `dl_coursera/lib/ExploringTree.py`
- [Bundled resources](https://github.com/flz101/dl_coursera/blob/master/dl_coursera/resource/__init__.py): `dl_coursera/resource/__init__.py`

### Download runtime

- [Task scheduler](https://github.com/flz101/dl_coursera/blob/master/dl_coursera/lib/TaskScheduler.py): `dl_coursera/lib/TaskScheduler.py`
- [Asset downloader](https://github.com/flz101/dl_coursera/blob/master/dl_coursera/Downloader.py): `dl_coursera/Downloader.py`
- [Runtime utilities](https://github.com/flz101/dl_coursera/blob/master/dl_coursera/lib/misc.py): `dl_coursera/lib/misc.py`
- [Dictionary models](https://github.com/flz101/dl_coursera/blob/master/dl_coursera/lib/MyDict.py): `dl_coursera/lib/MyDict.py`

### Other components

- **Downloader user**
- **Coursera API**
- **Course output files**
- **Asset network**

## Connections

- Downloader user → CLI workflow: supplies options (evidence: `README.md`)
- CLI workflow → Coursera crawler: starts crawl (evidence: `dl_coursera_run.py`)
- Coursera crawler → Coursera API: requests course data (evidence: `dl_coursera/Crawler.py`)
- Coursera crawler → Course models: builds models (evidence: `dl_coursera/Crawler.py`)
- Coursera crawler → CML conversion: converts CML (evidence: `dl_coursera/Crawler.py`)
- CLI workflow → Download task gatherer: gathers tasks (evidence: `dl_coursera_run.py`)
- Download task gatherer → Output path tree: builds output paths (evidence: `dl_coursera/DLTaskGatherer.py`)
- Download task gatherer → CML conversion: renders supplements (evidence: `dl_coursera/DLTaskGatherer.py`)
- Download task gatherer → Bundled resources: loads bundled files (evidence: `dl_coursera/DLTaskGatherer.py`)
- Download task gatherer → Course output files: writes files (evidence: `dl_coursera/DLTaskGatherer.py`)
- CLI workflow → Task scheduler: runs task queue (evidence: `dl_coursera_run.py`)
- CLI workflow → Asset downloader: starts downloads (evidence: `dl_coursera_run.py`)
- Asset downloader → Asset network: fetches assets (evidence: `dl_coursera/Downloader.py`)
- Asset downloader → Course output files: saves assets (evidence: `dl_coursera/Downloader.py`)
- Course models → Dictionary models: extends models (evidence: `dl_coursera/define.py`)
- Task scheduler → Runtime utilities: formats task details (evidence: `dl_coursera/lib/TaskScheduler.py`)
- CLI workflow → Course output files: writes crawl cache (evidence: `dl_coursera_run.py`)
