# curiolytics/pdfs_downloader architecture

> Architecture diagram of the GitHub repository curiolytics/pdfs_downloader, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/curiolytics/pdfs_downloader
- Repository: https://github.com/curiolytics/pdfs_downloader

## Overview

##### Main Components
- Entry Point: The main.py file serves as the entry point where execution is initiated.
- Web Driver Component: Represented by the function init_webdriver, this component sets up and manages the ChromeDriver instance.
- Authentication Module: The login_to_lms function handles the single authentication process. Emphasize that the system restricts the session to a single login.
- PDF Extraction Module: The get_pdf_links function is responsible for scanning the authenticated page for PDF links.
- Download Module: The download_pdfs function takes the filtered links and downloads PDF files to the "downloaded_files" directory.
- External Service: The LMS website (login URL and course URL) – show this as an external system that the scraper interacts with.

##### Out the Relationships and Flow
- Finally, the download_pdfs component writes output (PDF files) to the "downloaded_files" directory.

##### Architectural Patterns and Design Principles
- Modular Design: Each function (init_webdriver, login_to_lms, get_pdf_links, download_pdfs) is a self-contained module, which promotes separation of concerns.
- Pipeline Flow: Emphasize the sequential flow from initialization to PDF download, illustrating a pipeline-like execution.
- Input/Output Handling: Clearly list the required input parameters (ChromeDriver Path, URLs, credentials, etc.) and the final output (downloaded PDF files).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Main Pipeline
    A["Main Control Flow"]:::module
    B["WebDriver Setup (init_webdriver)"]:::module
    C["Authentication (login_to_lms)"]:::module
    D["LMS Website<br/>(Login & Course)"]:::external
    E["PDF Extraction (get_pdf_links)"]:::module
    F["Download PDFs (download_pdfs)"]:::module
    G["Output Storage (downloaded_files)"]:::storage

    %% Flow Connections
    A -->|"start_driver"| B
    B -->|"initiate_auth"| C
    C -->|"access_via_session"| D
    D -->|"navigate_course"| E
    E -->|"filter_links"| F
    F -->|"save_PDFs"| G

    %% Annotation for Single Authentication Constraint
    H["Note: Single Authentication Only"]:::note
    C --- H

    %% Click Events
    click A "https://github.com/curiolytics/pdfs_downloader/blob/master/main.py"
    click B "https://github.com/curiolytics/pdfs_downloader/blob/master/main.py"
    click C "https://github.com/curiolytics/pdfs_downloader/blob/master/main.py"
    click E "https://github.com/curiolytics/pdfs_downloader/blob/master/main.py"
    click F "https://github.com/curiolytics/pdfs_downloader/blob/master/main.py"
    click G "https://github.com/curiolytics/pdfs_downloader/tree/master/downloaded_files/"

    %% Styles
    classDef module fill:#bbf,stroke:#333,stroke-width:2px;
    classDef external fill:#cfc,stroke:#333,stroke-width:2px,stroke-dasharray: 5 5;
    classDef storage fill:#ffc,stroke:#333,stroke-width:2px;
    classDef note fill:#ffe6e6,stroke:#900,stroke-width:2px,stroke-dasharray: 3 3;
```
