# egbertbouman/youtube-comment-downloader architecture

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

- Interactive diagram: https://gitdiagram.com/egbertbouman/youtube-comment-downloader
- Repository: https://github.com/egbertbouman/youtube-comment-downloader

## Overview

This small Python package downloads YouTube comments without the YouTube API, either through its CLI or as a library. The CLI parses video and output options, requests comments, then writes JSONL, JSON, CSV, or semicolon-delimited CSV. The downloader fetches YouTube pages, handles consent and continuation requests, and yields normalized comment records. The README documents these formats and library use; no separate storage or service layer is present. Edges reflect the shown CLI calls and downloader HTTP requests.

Main entry points: [`youtube_comment_downloader/downloader.py`](https://github.com/egbertbouman/youtube-comment-downloader/blob/master/youtube_comment_downloader/downloader.py) (Comment downloader), [`youtube_comment_downloader/__init__.py`](https://github.com/egbertbouman/youtube-comment-downloader/blob/master/youtube_comment_downloader/__init__.py) (CLI workflow), [`youtube_comment_downloader/__main__.py`](https://github.com/egbertbouman/youtube-comment-downloader/blob/master/youtube_comment_downloader/__main__.py) (Module entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command line"]
  node_entry["Module entry<br/>[__main__.py]"]
  node_cli_main["CLI workflow<br/>[__init__.py]"]
end

subgraph group_download["Comment download"]
  node_downloader["Comment downloader<br/>[downloader.py]"]
  node_ajax["Continuation requests<br/>[downloader.py]"]
  node_search["Response traversal<br/>[downloader.py]"]
end

subgraph group_output["Output formatting"]
  node_writer["Comment writer<br/>[__init__.py]"]
end

node_user(("CLI user"))
node_youtube["YouTube"]
node_output_file["Output file"]

node_user -->|"runs CLI"| node_entry
node_entry -->|"calls main"| node_cli_main
node_cli_main -->|"requests comments"| node_downloader
node_downloader -->|"requests continuations"| node_ajax
node_downloader -->|"traverses responses"| node_search
node_downloader -->|"fetches pages and comments"| node_youtube
node_cli_main -->|"writes comments"| node_writer
node_writer -->|"writes formats"| node_output_file

click node_entry "https://github.com/egbertbouman/youtube-comment-downloader/blob/master/youtube_comment_downloader/__main__.py"
click node_cli_main "https://github.com/egbertbouman/youtube-comment-downloader/blob/master/youtube_comment_downloader/__init__.py"
click node_downloader "https://github.com/egbertbouman/youtube-comment-downloader/blob/master/youtube_comment_downloader/downloader.py"
click node_ajax "https://github.com/egbertbouman/youtube-comment-downloader/blob/master/youtube_comment_downloader/downloader.py"
click node_search "https://github.com/egbertbouman/youtube-comment-downloader/blob/master/youtube_comment_downloader/downloader.py"
click node_writer "https://github.com/egbertbouman/youtube-comment-downloader/blob/master/youtube_comment_downloader/__init__.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_entry,node_cli_main,node_user toneBlue
class node_downloader,node_ajax,node_search toneAmber
class node_writer toneMint
class node_youtube,node_output_file toneIndigo
```

## Components

### Command line

- [Module entry](https://github.com/egbertbouman/youtube-comment-downloader/blob/master/youtube_comment_downloader/__main__.py): `youtube_comment_downloader/__main__.py`
- [CLI workflow](https://github.com/egbertbouman/youtube-comment-downloader/blob/master/youtube_comment_downloader/__init__.py): `youtube_comment_downloader/__init__.py`

### Comment download

- [Comment downloader](https://github.com/egbertbouman/youtube-comment-downloader/blob/master/youtube_comment_downloader/downloader.py): `youtube_comment_downloader/downloader.py`
- [Continuation requests](https://github.com/egbertbouman/youtube-comment-downloader/blob/master/youtube_comment_downloader/downloader.py): `youtube_comment_downloader/downloader.py`
- [Response traversal](https://github.com/egbertbouman/youtube-comment-downloader/blob/master/youtube_comment_downloader/downloader.py): `youtube_comment_downloader/downloader.py`

### Output formatting

- [Comment writer](https://github.com/egbertbouman/youtube-comment-downloader/blob/master/youtube_comment_downloader/__init__.py): `youtube_comment_downloader/__init__.py`

### Other components

- **CLI user**
- **YouTube**
- **Output file**

## Connections

- CLI user → Module entry: runs CLI (evidence: `README.md`)
- Module entry → CLI workflow: calls main (evidence: `youtube_comment_downloader/__main__.py`)
- CLI workflow → Comment downloader: requests comments (evidence: `youtube_comment_downloader/__init__.py`)
- Comment downloader → Continuation requests: requests continuations (evidence: `youtube_comment_downloader/downloader.py`)
- Comment downloader → Response traversal: traverses responses (evidence: `youtube_comment_downloader/downloader.py`)
- Comment downloader → YouTube: fetches pages and comments (evidence: `youtube_comment_downloader/downloader.py`)
- CLI workflow → Comment writer: writes comments (evidence: `youtube_comment_downloader/__init__.py`)
- Comment writer → Output file: writes formats (evidence: `youtube_comment_downloader/__init__.py`)
