# akhilkammila/leetcode-screenshotter architecture

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

- Interactive diagram: https://gitdiagram.com/akhilkammila/leetcode-screenshotter
- Repository: https://github.com/akhilkammila/leetcode-screenshotter

## Overview

This repository collects LeetCode problem and editorial screenshots, with editorial code also kept as a content collection. The capture workflow uses a runner to select records, wraps screenshotters for retries and diagnostics, then uses Selenium-backed capture logic to load a page, measure its content, and save an image. A separate parser gathers editorial links from the problem listing. The source excerpts show the capture and parser details; the README documents the editorial and premium-problem scope, but not all data or output paths.

Main entry points: [`screenshotter/problem_screenshotter.py`](https://github.com/akhilkammila/leetcode-screenshotter/blob/main/screenshotter/problem_screenshotter.py) (Problem capture), [`screenshotter/editorial_screenshotter.py`](https://github.com/akhilkammila/leetcode-screenshotter/blob/main/screenshotter/editorial_screenshotter.py) (Editorial capture), [`screenshotter/runner.py`](https://github.com/akhilkammila/leetcode-screenshotter/blob/main/screenshotter/runner.py) (Capture runner), [`problem-data-parser/editorial_scraper.py`](https://github.com/akhilkammila/leetcode-screenshotter/blob/main/problem-data-parser/editorial_scraper.py) (Editorial scraper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Problem collection"]
  node_parser["Editorial scraper"]
  node_parser_base["Parser browser base<br/>[selenium_base.py]"]
  node_parser_locators["Parser locators<br/>[locators.py]"]
end

subgraph group_capture["Screenshot capture"]
  node_capture_runner["Capture runner<br/>[runner.py]"]
  node_debug["Debug wrapper<br/>[debug_wrapper.py]"]
  node_problem_capture["Problem capture"]
  node_editorial_capture["Editorial capture"]
end

subgraph group_browser["Browser support"]
  node_browser_base["Browser base<br/>[selenium_base.py]"]
  node_locators["Page locators<br/>[locators.py]"]
end

subgraph group_content["Saved content"]
  node_premium_images["Premium screenshots"]
  node_editorial_images["Editorial screenshots"]
  node_editorial_code["Editorial code"]
end

node_operator(("Operator"))
node_leetcode{{"LeetCode"}}
node_selenium{{"Selenium WebDriver"}}

node_parser -->|"inherits"| node_parser_base
node_parser -->|"uses selectors"| node_parser_locators
node_parser -->|"reads listing"| node_leetcode
node_operator -.->|"starts capture"| node_capture_runner
node_capture_runner -->|"dispatches"| node_problem_capture
node_capture_runner -->|"dispatches"| node_editorial_capture
node_capture_runner -->|"wraps capture"| node_debug
node_debug -.->|"delegates calls"| node_problem_capture
node_debug -.->|"delegates calls"| node_editorial_capture
node_problem_capture -->|"inherits"| node_browser_base
node_editorial_capture -->|"inherits"| node_browser_base
node_problem_capture -->|"uses selectors"| node_locators
node_editorial_capture -->|"uses selectors"| node_locators
node_browser_base -->|"drives browser"| node_selenium
node_problem_capture -->|"loads problem pages"| node_leetcode
node_editorial_capture -->|"loads editorial pages"| node_leetcode
node_problem_capture -->|"saves screenshots"| node_premium_images
node_editorial_capture -->|"saves screenshots"| node_editorial_images

click node_parser "https://github.com/akhilkammila/leetcode-screenshotter/blob/main/problem-data-parser/editorial_scraper.py"
click node_parser_base "https://github.com/akhilkammila/leetcode-screenshotter/blob/main/problem-data-parser/selenium_base.py"
click node_parser_locators "https://github.com/akhilkammila/leetcode-screenshotter/blob/main/problem-data-parser/locators.py"
click node_capture_runner "https://github.com/akhilkammila/leetcode-screenshotter/blob/main/screenshotter/runner.py"
click node_debug "https://github.com/akhilkammila/leetcode-screenshotter/blob/main/screenshotter/debug_wrapper.py"
click node_problem_capture "https://github.com/akhilkammila/leetcode-screenshotter/blob/main/screenshotter/problem_screenshotter.py"
click node_editorial_capture "https://github.com/akhilkammila/leetcode-screenshotter/blob/main/screenshotter/editorial_screenshotter.py"
click node_browser_base "https://github.com/akhilkammila/leetcode-screenshotter/blob/main/screenshotter/selenium_base.py"
click node_locators "https://github.com/akhilkammila/leetcode-screenshotter/blob/main/screenshotter/locators.py"
click node_editorial_code "https://github.com/akhilkammila/leetcode-screenshotter/tree/main/editorial_code"

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_parser,node_parser_base,node_parser_locators toneBlue
class node_capture_runner,node_debug,node_problem_capture,node_editorial_capture toneAmber
class node_browser_base,node_locators toneMint
class node_premium_images,node_editorial_images,node_editorial_code toneRose
class node_operator,node_leetcode,node_selenium toneIndigo
```

## Components

### Problem collection

- [Editorial scraper](https://github.com/akhilkammila/leetcode-screenshotter/blob/main/problem-data-parser/editorial_scraper.py): `problem-data-parser/editorial_scraper.py`
- [Parser browser base](https://github.com/akhilkammila/leetcode-screenshotter/blob/main/problem-data-parser/selenium_base.py): `problem-data-parser/selenium_base.py`
- [Parser locators](https://github.com/akhilkammila/leetcode-screenshotter/blob/main/problem-data-parser/locators.py): `problem-data-parser/locators.py`

### Screenshot capture

- [Capture runner](https://github.com/akhilkammila/leetcode-screenshotter/blob/main/screenshotter/runner.py): `screenshotter/runner.py`
- [Debug wrapper](https://github.com/akhilkammila/leetcode-screenshotter/blob/main/screenshotter/debug_wrapper.py): `screenshotter/debug_wrapper.py`
- [Problem capture](https://github.com/akhilkammila/leetcode-screenshotter/blob/main/screenshotter/problem_screenshotter.py): `screenshotter/problem_screenshotter.py`
- [Editorial capture](https://github.com/akhilkammila/leetcode-screenshotter/blob/main/screenshotter/editorial_screenshotter.py): `screenshotter/editorial_screenshotter.py`

### Browser support

- [Browser base](https://github.com/akhilkammila/leetcode-screenshotter/blob/main/screenshotter/selenium_base.py): `screenshotter/selenium_base.py`
- [Page locators](https://github.com/akhilkammila/leetcode-screenshotter/blob/main/screenshotter/locators.py): `screenshotter/locators.py`

### Saved content

- **Premium screenshots**
- **Editorial screenshots**
- [Editorial code](https://github.com/akhilkammila/leetcode-screenshotter/tree/main/editorial_code): `editorial_code`

### Other components

- **Operator**
- **LeetCode**
- **Selenium WebDriver**

## Connections

- Editorial scraper → Parser browser base: inherits (evidence: `problem-data-parser/editorial_scraper.py`)
- Editorial scraper → Parser locators: uses selectors (evidence: `problem-data-parser/editorial_scraper.py`)
- Editorial scraper → LeetCode: reads listing (evidence: `problem-data-parser/editorial_scraper.py`)
- Operator → Capture runner: starts capture
- Capture runner → Problem capture: dispatches (evidence: `screenshotter/runner.py`)
- Capture runner → Editorial capture: dispatches (evidence: `screenshotter/runner.py`)
- Capture runner → Debug wrapper: wraps capture (evidence: `screenshotter/runner.py`)
- Debug wrapper → Problem capture: delegates calls
- Debug wrapper → Editorial capture: delegates calls
- Problem capture → Browser base: inherits (evidence: `screenshotter/problem_screenshotter.py`)
- Editorial capture → Browser base: inherits (evidence: `screenshotter/editorial_screenshotter.py`)
- Problem capture → Page locators: uses selectors (evidence: `screenshotter/problem_screenshotter.py`)
- Editorial capture → Page locators: uses selectors (evidence: `screenshotter/editorial_screenshotter.py`)
- Browser base → Selenium WebDriver: drives browser (evidence: `screenshotter/selenium_base.py`)
- Problem capture → LeetCode: loads problem pages (evidence: `screenshotter/problem_screenshotter.py`)
- Editorial capture → LeetCode: loads editorial pages (evidence: `screenshotter/editorial_screenshotter.py`)
- Problem capture → Premium screenshots: saves screenshots (evidence: `screenshotter/problem_screenshotter.py`)
- Editorial capture → Editorial screenshots: saves screenshots (evidence: `screenshotter/editorial_screenshotter.py`)
