# mr-aicoder/videotoblog_ai architecture

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

- Interactive diagram: https://gitdiagram.com/mr-aicoder/videotoblog_ai
- Repository: https://github.com/mr-aicoder/videotoblog_ai

## Overview

##### Project type and purpose
- This is a Python-based, end-to-end AI automation pipeline (a monolithic tool) that ingests a YouTube video URL, transcribes speech, summarizes content, expands it into an SEO-optimized blog post, and then publishes to Blogger.

##### File structure
- Top-level files:
- main.py – the CLI entry point and orchestration script
- blog_agent.py – contains the core logic broken into functional modules (fetching, transcription, summarization, generation, publishing)
- .env – environment variables for API keys and credentials
- requirements.txt / packages.txt – Python dependencies
- __pycache__ – compiled bytecode (not part of architecture)
- No separate “frontend” or “backend” directories: this is a single-process pipeline.

##### README for additional insights
- Four main processing stages:
a. Automated Transcription (YouTube Data API + Speech-to-Text)
b. Intelligent Summarization (fine-tuned LLM via transformer libraries)
c. Content Expansion & Generation (Generative AI, Hugging Face or OpenAI)
d. Automated Publishing (Blogger API)
- Data handling (Pandas) and NLP libraries (SpaCy, NLTK) support pre-/post-processing.

1) CLI Orchestrator (main.py)
2) Config Manager (.env loader)
3) YouTube Fetcher (YouTube Data API client)
4) Transcription Service (Google Cloud Speech-to-Text API)
5) Summarization Engine (LLM summarizer)
6) Generation Engine (LLM content-expander)
7) Publishing Service (Blogger API client)
8) Data Store (in-memory or temporary files/ Pandas DataFrames)

- CLI → Config Manager (load credentials)
- CLI → YouTube Fetcher → speech audio
- Audio → Transcription Service → raw transcript
- Transcript → Summarization Engine → summary
- Summary → Generation Engine → full blog post
- Blog post → Publishing Service → Blogger platform
- Each service requests external API, then returns results to the next internal module.

c. Architectural patterns & design principles:
- Linear pipeline (staged processing)
- Single-process modular design (separation of concerns)
- Externalization of configuration (12-factor “config in env”)
- API adapter pattern for each third-party integration

- Python 3.x
- google-api-python-client + google-auth-oauthlib
- Google Cloud Speech-to-Text API
- YouTube Data API
- Transformers (Hugging Face), torch/tensorflow
- OpenAI API or LLaMA (if using local LLM)
- SpaCy, NLTK, Pandas

##### Thoroughness
- Every stage—don’t collapse transcription, summarization, and generation into a single block.
- How credentials/config propagate to each API client.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Input Layer"
        CLI["CLI Orchestrator<br/>(main.py)"]:::internal
        Config["Config Manager<br/>(.env)"]:::internal
        Deps["Dependencies<br/>(requirements.txt, packages.txt)"]:::internal
    end

    subgraph "Integration Layer"
        YTF["YouTube Fetcher<br/>(blog_agent.py)"]:::internal
        TS["Transcription Service<br/>(blog_agent.py)"]:::internal
        PUBA["Publishing Service<br/>(blog_agent.py)"]:::internal
    end

    subgraph "Processing Layer"
        Summ["Summarization Engine<br/>(blog_agent.py)"]:::internal
        Gen["Generation Engine<br/>(blog_agent.py)"]:::internal
    end

    subgraph "External Services"
        YTAPI["YouTube Data API"]:::external
        GCP["Google Cloud Speech-to-Text"]:::external
        LLM["LLM Provider<br/>(HuggingFace/OpenAI)"]:::external
        BLOGGER["Blogger API"]:::external
    end

    subgraph "Data Store"
        DS["Temp Data (Pandas DataFrames)"]:::datastore
    end

    %% Data Flow
    CLI -->|"load config"| Config
    CLI -->|"start pipeline"| YTF
    Config --> YTF
    Config --> TS
    Config --> Summ
    Config --> Gen
    Config --> PUBA
    Deps --> CLI

    YTF -->|"fetch video metadata"| YTAPI
    YTF -->|"audio blob"| DS
    DS -->|"audio blob"| TS

    TS -->|"transcribe audio"| GCP
    TS -->|"raw transcript"| DS
    DS -->|"transcript text"| Summ

    Summ -->|"summarize transcript"| LLM
    Summ -->|"summary text"| DS
    DS -->|"summary text"| Gen

    Gen -->|"expand summary"| LLM
    Gen -->|"post content"| DS
    DS -->|"post content"| PUBA

    PUBA -->|"publish request"| BLOGGER

    %% Click Events
    click CLI "https://github.com/mr-aicoder/videotoblog_ai/blob/main/main.py"
    click Config "https://github.com/mr-aicoder/videotoblog_ai/blob/main/.env"
    click Deps "https://github.com/mr-aicoder/videotoblog_ai/blob/main/requirements.txt"
    click Deps "https://github.com/mr-aicoder/videotoblog_ai/blob/main/packages.txt"
    click YTF "https://github.com/mr-aicoder/videotoblog_ai/blob/main/blog_agent.py"
    click TS "https://github.com/mr-aicoder/videotoblog_ai/blob/main/blog_agent.py"
    click Summ "https://github.com/mr-aicoder/videotoblog_ai/blob/main/blog_agent.py"
    click Gen "https://github.com/mr-aicoder/videotoblog_ai/blob/main/blog_agent.py"
    click PUBA "https://github.com/mr-aicoder/videotoblog_ai/blob/main/blog_agent.py"

    %% Styles
    classDef internal fill:#e0f7ff,stroke:#000
    classDef external fill:#e0ffe0,stroke:#000
    classDef datastore fill:#f2f2f2,stroke:#000
```
