# better-than-you/brainrotbot architecture

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

- Interactive diagram: https://gitdiagram.com/better-than-you/brainrotbot
- Repository: https://github.com/better-than-you/brainrotbot

## Overview

##### Main Components

A. Input Layer:
- Reddit Scraper Component (from Utils/Scraper)
- Both reddit_scraper.py and reddit_screenshot.py as separate modules
- Reddit API connection point

B. Processing Layer:
- Text-to-Speech Engine Hub
- Three TTS providers: Google, Kokoro, and TikTok
- Them as parallel services
- Video Editor Component
- Base video handling
- Editing pipeline

C. Output Layer:
- Final Video Generation
- Video Storage/Export

- [Reddit API]
- ↓
- [Scraping Layer]
- /                    \
**[Text Extraction]    [Screenshot Capture]**
- /
- [Content Pool]
- ↓
- [TTS Processing Hub]
- /        |          \
- [Google]  [Kokoro]    [TikTok]
- /
- [Audio Assembly]
- ↓
- [Video Editing Pipeline]
- ↓
- [Final Video Output]

##### Important Details to Highlight

a. Data Flow Patterns:
- How content moves from Reddit to the scraper
- Parallel processing in TTS engines
- Demonstrate the video assembly pipeline

b. Integration Points:
- API connection points
- File system interactions
- Where configuration settings apply

##### Technical Specifications

- Python as the primary technology
- External API dependencies
- File format transformations (text → audio → video)

##### Implementation Notes

- Use standardized UML notation where applicable
- Version/date information
- Brief component descriptions

##### Key Relationships to Emphasize

- Scraper → Content Processing
- Text → Audio Conversion
- Audio + Visual → Final Video
- Configuration → Component Settings

Remember to include:
- Input/Output formats at each stage
- Error handling paths
- Configuration injection points
- Resource utilization flows

This will provide a complete picture of how the Reddit Video Maker Bot transforms Reddit content into automated video content through its various processing stages.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        RA[Reddit API]
        RS["Reddit Scraper"]:::scraper
        SC["Screenshot Capture"]:::scraper
    end

    subgraph Processing
        CP[Content Pool]
        TH[TTS Hub]
        
        subgraph "TTS Engines"
            GT["Google TTS"]:::tts
            KT["Kokoro TTS"]:::tts
            TT["TikTok TTS"]:::tts
        end
        
        AA[Audio Assembly]
        VE["Video Editor"]:::editor
        BV["Base Video"]:::resource
    end

    subgraph Output
        FV[Final Video]
    end

    subgraph Config
        CM["Configuration"]:::config
    end

    %% Connections
    RA --> RS
    RS --> CP
    RA --> SC
    SC --> CP
    
    CP --> TH
    TH --> GT
    TH --> KT
    TH --> TT
    
    GT --> AA
    KT --> AA
    TT --> AA
    
    AA --> VE
    BV --> VE
    VE --> FV
    
    CM -.-> RS
    CM -.-> TH
    CM -.-> VE

    %% Styles
    classDef scraper fill:#a2d2ff
    classDef tts fill:#bde0fe
    classDef editor fill:#ffafcc
    classDef resource fill:#ffc8dd
    classDef config fill:#cdb4db

    %% Click Events
    click RS "https://github.com/Better-Than-You/brainrotbot/blob/main/Utils/Scraper/reddit_scraper.py"
    click SC "https://github.com/Better-Than-You/brainrotbot/blob/main/Utils/Scraper/reddit_screenshot.py"
    click GT "https://github.com/Better-Than-You/brainrotbot/blob/main/Utils/Audio/google_tts/google.audio.py"
    click KT "https://github.com/Better-Than-You/brainrotbot/blob/main/Utils/Audio/kokoro_tts/kokoro_audio.py"
    click TT "https://github.com/Better-Than-You/brainrotbot/blob/main/Utils/Audio/tiktok_tts/tiktok_audio.py"
    click VE "https://github.com/Better-Than-You/brainrotbot/blob/main/Utils/Edit/edit.py"
    click BV "https://github.com/Better-Than-You/brainrotbot/blob/main/Utils/Edit/Base/base_video.mp4"
    click CM "https://github.com/Better-Than-You/brainrotbot/blob/main/.env.example"

    %% Legend
    subgraph Legend
        L1[Scraping Components]:::scraper
        L2[TTS Components]:::tts
        L3[Editing Components]:::editor
        L4[Resources]:::resource
        L5[Configuration]:::config
    end
```
