# rekyungmin/biblebot-scraper architecture

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

- Interactive diagram: https://gitdiagram.com/rekyungmin/biblebot-scraper
- Repository: https://github.com/rekyungmin/biblebot-scraper

## Overview

##### Main Components

a. Core Components:
- HTTP Client Layer
- Both `aiohttp` and `requests` implementations
- Abstract `BaseRequest` class
- API Layer
- Five main API modules (Intranet, LMS, KBU, Mileage, Library)
- Parser Layer
- Parsing functionality for each API

b. External Systems:
- Five target websites to scrape:
- KBU Intranet (kbuis.bible.ac.kr)
- KBU LMS (lms.bible.ac.kr)
- KBU Homepage (bible.ac.kr)
- OKPOS Mileage System
- KBU Library

**[External Websites] <--HTTP--> [HTTP Client Layer] <--> [API Layer] <--> [Parser Layer] --> [Structured Data Output]**

##### Specific Elements

a. HTTP Client Layer:
- Abstraction with `BaseRequest`
- Both async (`aiohttp_conn`) and sync (`requests_conn`) implementations
- Extensibility for other HTTP clients

b. API Layer:
- Five main API modules
- Common utilities and base classes
- Shared functionality through `common.py`

c. Parser Layer:
- How each API module has its own parsing logic
- Use of BeautifulSoup4 for HTML parsing

##### Important Details to Highlight

- The modular nature of the HTTP client implementation
- The separation of concerns between fetching and parsing
- The common base classes and utilities
- The async/sync support
- The extensibility points

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef external fill:#a8d1f0,stroke:#333
    classDef http fill:#90EE90,stroke:#333
    classDef api fill:#FFE5B4,stroke:#333
    classDef parser fill:#FFA07A,stroke:#333
    classDef output fill:#DDA0DD,stroke:#333
    classDef abstract fill:#F0F0F0,stroke:#333,stroke-dasharray: 5 5

    %% External Systems
    subgraph ExternalSystems["External Systems"]
        KBUIntranet[("KBU Intranet")]:::external
        KBULMS[("KBU LMS")]:::external
        KBUHome[("KBU Homepage")]:::external
        OKPOS[("OKPOS Mileage")]:::external
        KBULib[("KBU Library")]:::external
    end

    %% HTTP Client Layer
    subgraph HTTPLayer["HTTP Client Layer"]
        BaseRequest[("BaseRequest")]:::abstract
        AsyncClient["Async Client\n(aiohttp)"]:::http
        SyncClient["Sync Client\n(requests)"]:::http
    end

    %% API Layer
    subgraph APILayer["API Layer"]
        APIBase["API Base Class"]:::api
        CommonUtils["Common Utilities"]:::api
        IntranetAPI["Intranet API"]:::api
        LMSAPI["LMS API"]:::api
        KBUAPI["KBU API"]:::api
        MileageAPI["Mileage API"]:::api
        LibraryAPI["Library API"]:::api
    end

    %% Parser Layer
    subgraph ParserLayer["Parser Layer"]
        BeautifulSoup["BeautifulSoup4"]:::parser
        IntranetParser["Intranet Parser"]:::parser
        LMSParser["LMS Parser"]:::parser
        KBUParser["KBU Parser"]:::parser
        MileageParser["Mileage Parser"]:::parser
        LibraryParser["Library Parser"]:::parser
    end

    %% Output
    StructuredData["Structured Data Output"]:::output

    %% Relationships
    ExternalSystems --> HTTPLayer
    BaseRequest --> AsyncClient
    BaseRequest --> SyncClient
    HTTPLayer --> APILayer
    APIBase --> IntranetAPI & LMSAPI & KBUAPI & MileageAPI & LibraryAPI
    CommonUtils --> IntranetAPI & LMSAPI & KBUAPI & MileageAPI & LibraryAPI
    APILayer --> ParserLayer
    BeautifulSoup --> IntranetParser & LMSParser & KBUParser & MileageParser & LibraryParser
    ParserLayer --> StructuredData

    %% Click Events
    click BaseRequest "https://github.com/rekyungmin/biblebot-scraper/blob/master/biblebot/reqeust/base.py"
    click AsyncClient "https://github.com/rekyungmin/biblebot-scraper/blob/master/biblebot/reqeust/aiohttp_conn.py"
    click SyncClient "https://github.com/rekyungmin/biblebot-scraper/blob/master/biblebot/reqeust/requests_conn.py"
    click APIBase "https://github.com/rekyungmin/biblebot-scraper/blob/master/biblebot/api/base.py"
    click CommonUtils "https://github.com/rekyungmin/biblebot-scraper/blob/master/biblebot/api/common.py"
    click IntranetAPI "https://github.com/rekyungmin/biblebot-scraper/blob/master/biblebot/api/intranet.py"
    click LMSAPI "https://github.com/rekyungmin/biblebot-scraper/blob/master/biblebot/api/lms.py"
    click KBUAPI "https://github.com/rekyungmin/biblebot-scraper/blob/master/biblebot/api/kbu.py"
    click MileageAPI "https://github.com/rekyungmin/biblebot-scraper/blob/master/biblebot/api/mileage.py"
    click LibraryAPI "https://github.com/rekyungmin/biblebot-scraper/blob/master/biblebot/api/library.py"
```
