# themrsami/scribd-downloader architecture

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

- Interactive diagram: https://gitdiagram.com/themrsami/scribd-downloader
- Repository: https://github.com/themrsami/scribd-downloader

## Overview

Scribd Downloader is an interactive Python utility that turns a Scribd document URL into a locally saved PDF. The main workflow validates and converts the URL, opens the embed in headless Chrome, prepares and loads document pages, prints each page, then merges the page PDFs. The README also documents direct batched loading with a scrolling fallback, layout cleanup, dynamic page sizing, and bounded-memory export. The implementation is concentrated in one script; omitted source excerpts limit certainty about some internal call wiring.

Main entry points: [`scribd-downloader.py`](https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py) (Interactive runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Input and Setup"]
  node_main["Interactive runner"]
  node_url["URL conversion"]
  node_filename["Filename derivation"]
end

subgraph group_browser["Browser and Pages"]
  node_chrome["Chrome browser"]
  node_scribd["Scribd embed"]
  node_cleanup["Page cleanup"]
  node_page_load["Page loading"]
  node_direct_loader["Direct batch loader"]
  node_scroll_fallback["Scrolling fallback"]
  node_batch_release["Batch release"]
  node_settle["Render settling"]
end

subgraph group_export["PDF Export"]
  node_paper_size["Page sizing"]
  node_page_print["Per-page printing"]
end

subgraph group_storage["Output and Storage"]
  node_temp_storage[("Temporary page PDFs")]
  node_merge["PDF merge"]
  node_output["Final PDF"]
end

node_user(("User"))

node_user -->|"provides URL"| node_main
node_main -->|"converts URL"| node_url
node_main -->|"derives name"| node_filename
node_main -->|"starts browser"| node_chrome
node_main -->|"opens embed"| node_scribd
node_scribd -->|"serves document"| node_chrome
node_main -->|"cleans page"| node_cleanup
node_main -->|"loads pages"| node_page_load
node_page_load -->|"loads directly"| node_direct_loader
node_page_load -.->|"falls back"| node_scroll_fallback
node_main -->|"waits for render"| node_settle
node_main -->|"detects dimensions"| node_paper_size
node_main -->|"prints pages"| node_page_print
node_page_print -->|"prints via CDP"| node_chrome
node_page_print -->|"spools pages"| node_temp_storage
node_main -->|"releases batches"| node_batch_release
node_batch_release -->|"frees page resources"| node_chrome
node_main -->|"merges pages"| node_merge
node_merge -->|"reads pages"| node_temp_storage
node_merge -->|"writes PDF"| node_output
node_filename -->|"names file"| node_output
node_output -->|"saves locally"| node_user

click node_main "https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py"
click node_url "https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py"
click node_filename "https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py"
click node_cleanup "https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py"
click node_page_load "https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py"
click node_direct_loader "https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py"
click node_scroll_fallback "https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py"
click node_batch_release "https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py"
click node_settle "https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py"
click node_paper_size "https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py"
click node_page_print "https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py"
click node_merge "https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.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_url,node_filename,node_user toneBlue
class node_chrome,node_scribd,node_cleanup,node_page_load,node_direct_loader,node_scroll_fallback,node_batch_release,node_settle toneAmber
class node_paper_size,node_page_print toneMint
class node_temp_storage,node_merge,node_output toneRose
```

## Components

### Input and Setup

- [Interactive runner](https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py): `scribd-downloader.py`
- [URL conversion](https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py): `scribd-downloader.py`
- [Filename derivation](https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py): `scribd-downloader.py`

### Browser and Pages

- **Chrome browser**
- **Scribd embed**
- [Page cleanup](https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py): `scribd-downloader.py`
- [Page loading](https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py): `scribd-downloader.py`
- [Direct batch loader](https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py): `scribd-downloader.py`
- [Scrolling fallback](https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py): `scribd-downloader.py`
- [Batch release](https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py): `scribd-downloader.py`
- [Render settling](https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py): `scribd-downloader.py`

### PDF Export

- [Page sizing](https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py): `scribd-downloader.py`
- [Per-page printing](https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py): `scribd-downloader.py`

### Output and Storage

- **Temporary page PDFs**
- [PDF merge](https://github.com/themrsami/scribd-downloader/blob/main/scribd-downloader.py): `scribd-downloader.py`
- **Final PDF**

### Other components

- **User**

## Connections

- User → Interactive runner: provides URL
- Interactive runner → URL conversion: converts URL
- Interactive runner → Filename derivation: derives name
- Interactive runner → Chrome browser: starts browser
- Interactive runner → Scribd embed: opens embed
- Scribd embed → Chrome browser: serves document
- Interactive runner → Page cleanup: cleans page
- Interactive runner → Page loading: loads pages
- Page loading → Direct batch loader: loads directly
- Page loading → Scrolling fallback: falls back
- Interactive runner → Render settling: waits for render
- Interactive runner → Page sizing: detects dimensions
- Interactive runner → Per-page printing: prints pages
- Per-page printing → Chrome browser: prints via CDP
- Per-page printing → Temporary page PDFs: spools pages
- Interactive runner → Batch release: releases batches
- Batch release → Chrome browser: frees page resources
- Interactive runner → PDF merge: merges pages
- PDF merge → Temporary page PDFs: reads pages
- PDF merge → Final PDF: writes PDF
- Filename derivation → Final PDF: names file
- Final PDF → User: saves locally
