# hynanhat/autoblog architecture

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

- Interactive diagram: https://gitdiagram.com/hynanhat/autoblog
- Repository: https://github.com/hynanhat/autoblog

## Overview

AutoBlog is a desktop tool that automates Shinobi Blog account setup and HTML publishing, with an optional local Hiragana CAPTCHA OCR service. Its main workflow runs from account and article configuration in the GUI through browser automation to per-account publication results; CAPTCHA solving can use OCR or fall back to manual input. The graph also preserves the OCR service’s queue, recognition, web-review, and evaluation capabilities. Relationships are based on the README and shown source/index references; unsampled implementation details are not inferred.

Main entry points: [`ninja_worker.py`](https://github.com/hynanhat/autoblog/blob/main/ninja_worker.py) (Browser runner), [`ocr/ocr_service.py`](https://github.com/hynanhat/autoblog/blob/main/ocr/ocr_service.py) (Gemini recognition), [`app.py`](https://github.com/hynanhat/autoblog/blob/main/app.py) (Desktop GUI), [`hiragana_hook.py`](https://github.com/hynanhat/autoblog/blob/main/hiragana_hook.py) (Captcha solver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_autoblog["Blog automation"]
  node_gui["Desktop GUI<br/>[app.py]"]
  node_parsers["Input parsers<br/>[parsers.py]"]
  node_runner["Browser runner<br/>[ninja_worker.py]"]
  node_captcha_capture["Captcha capture<br/>[ninja_hiragana.py]"]
  node_account_setup["Account setup<br/>[ninja_worker.py]"]
  node_domain_select["Domain selection<br/>[ninja_worker.py]"]
  node_article_publish["Article publishing<br/>[ninja_worker.py]"]
end

subgraph group_ocrclient["CAPTCHA integration"]
  node_captcha_hook["Captcha solver<br/>[hiragana_hook.py]"]
  node_ocr_client["OCR HTTP client<br/>[ocr_client.py]"]
end

subgraph group_ocrservice["OCR service"]
  node_inbox["Image inbox<br/>[folder_ocr.py]"]
  node_server["OCR API server<br/>[server.py]"]
  node_job_store[("Job store<br/>[folder_ocr.py]")]
  node_recognition["Gemini recognition<br/>[ocr_service.py]"]
  node_image_processing["Image preprocessing<br/>[preprocess.py]"]
  node_formatter["Hiragana formatter<br/>[formatter.py]"]
  node_key_pool["API key pool<br/>[key_pool.py]"]
end

subgraph group_ocrtools["OCR tools"]
  node_ocr_ui["OCR review UI<br/>[ocr_ui.py]"]
  node_evaluation["OCR evaluation<br/>[evaluate.py]"]
end

node_user(("Operator"))
node_shinobi{{"Shinobi Blog"}}
node_gemini{{"Google Gemini"}}

node_user -->|"configures jobs"| node_gui
node_gui -->|"parses inputs"| node_parsers
node_gui -->|"starts worker"| node_runner
node_runner -->|"captures captcha"| node_captcha_capture
node_runner -->|"creates accounts"| node_account_setup
node_runner -->|"selects domain"| node_domain_select
node_runner -->|"publishes HTML"| node_article_publish
node_account_setup -->|"registers on"| node_shinobi
node_domain_select -->|"checks domains"| node_shinobi
node_article_publish -->|"publishes to"| node_shinobi
node_runner -->|"requests solution"| node_captcha_hook
node_captcha_hook -->|"tries OCR"| node_ocr_client
node_captcha_hook -->|"falls back to"| node_user
node_ocr_client -->|"writes images"| node_inbox
node_ocr_client -->|"polls results"| node_server
node_server -->|"reads jobs"| node_job_store
node_server -->|"runs recognition"| node_recognition
node_recognition -->|"uses keys"| node_key_pool
node_recognition -->|"recognizes with"| node_gemini
node_recognition -->|"formats output"| node_formatter
node_inbox -->|"processes images"| node_image_processing
node_ocr_ui -->|"tests readings"| node_recognition
node_ocr_ui -->|"previews cleanup"| node_image_processing
node_evaluation -->|"compares readings"| node_recognition
node_evaluation -->|"compares variants"| node_image_processing

click node_gui "https://github.com/hynanhat/autoblog/blob/main/app.py"
click node_parsers "https://github.com/hynanhat/autoblog/blob/main/parsers.py"
click node_runner "https://github.com/hynanhat/autoblog/blob/main/ninja_worker.py"
click node_captcha_capture "https://github.com/hynanhat/autoblog/blob/main/ninja_hiragana.py"
click node_account_setup "https://github.com/hynanhat/autoblog/blob/main/ninja_worker.py"
click node_domain_select "https://github.com/hynanhat/autoblog/blob/main/ninja_worker.py"
click node_article_publish "https://github.com/hynanhat/autoblog/blob/main/ninja_worker.py"
click node_captcha_hook "https://github.com/hynanhat/autoblog/blob/main/hiragana_hook.py"
click node_ocr_client "https://github.com/hynanhat/autoblog/blob/main/ocr_client.py"
click node_inbox "https://github.com/hynanhat/autoblog/blob/main/ocr/folder_ocr.py"
click node_server "https://github.com/hynanhat/autoblog/blob/main/ocr/server.py"
click node_job_store "https://github.com/hynanhat/autoblog/blob/main/ocr/folder_ocr.py"
click node_recognition "https://github.com/hynanhat/autoblog/blob/main/ocr/ocr_service.py"
click node_image_processing "https://github.com/hynanhat/autoblog/blob/main/ocr/preprocess.py"
click node_formatter "https://github.com/hynanhat/autoblog/blob/main/ocr/formatter.py"
click node_key_pool "https://github.com/hynanhat/autoblog/blob/main/ocr/key_pool.py"
click node_ocr_ui "https://github.com/hynanhat/autoblog/blob/main/ocr/ocr_ui.py"
click node_evaluation "https://github.com/hynanhat/autoblog/blob/main/ocr/evaluate.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_gui,node_parsers,node_runner,node_captcha_capture,node_account_setup,node_domain_select,node_article_publish toneBlue
class node_captcha_hook,node_ocr_client toneAmber
class node_inbox,node_server,node_job_store,node_recognition,node_image_processing,node_formatter,node_key_pool toneMint
class node_ocr_ui,node_evaluation toneRose
class node_user,node_shinobi,node_gemini toneIndigo
```

## Components

### Blog automation

- [Desktop GUI](https://github.com/hynanhat/autoblog/blob/main/app.py): `app.py`
- [Input parsers](https://github.com/hynanhat/autoblog/blob/main/parsers.py): `parsers.py`
- [Browser runner](https://github.com/hynanhat/autoblog/blob/main/ninja_worker.py): `ninja_worker.py`
- [Captcha capture](https://github.com/hynanhat/autoblog/blob/main/ninja_hiragana.py): `ninja_hiragana.py`
- [Account setup](https://github.com/hynanhat/autoblog/blob/main/ninja_worker.py): `ninja_worker.py`
- [Domain selection](https://github.com/hynanhat/autoblog/blob/main/ninja_worker.py): `ninja_worker.py`
- [Article publishing](https://github.com/hynanhat/autoblog/blob/main/ninja_worker.py): `ninja_worker.py`

### CAPTCHA integration

- [Captcha solver](https://github.com/hynanhat/autoblog/blob/main/hiragana_hook.py): `hiragana_hook.py`
- [OCR HTTP client](https://github.com/hynanhat/autoblog/blob/main/ocr_client.py): `ocr_client.py`

### OCR service

- [Image inbox](https://github.com/hynanhat/autoblog/blob/main/ocr/folder_ocr.py): `ocr/folder_ocr.py`
- [OCR API server](https://github.com/hynanhat/autoblog/blob/main/ocr/server.py): `ocr/server.py`
- [Job store](https://github.com/hynanhat/autoblog/blob/main/ocr/folder_ocr.py): `ocr/folder_ocr.py`
- [Gemini recognition](https://github.com/hynanhat/autoblog/blob/main/ocr/ocr_service.py): `ocr/ocr_service.py`
- [Image preprocessing](https://github.com/hynanhat/autoblog/blob/main/ocr/preprocess.py): `ocr/preprocess.py`
- [Hiragana formatter](https://github.com/hynanhat/autoblog/blob/main/ocr/formatter.py): `ocr/formatter.py`
- [API key pool](https://github.com/hynanhat/autoblog/blob/main/ocr/key_pool.py): `ocr/key_pool.py`

### OCR tools

- [OCR review UI](https://github.com/hynanhat/autoblog/blob/main/ocr/ocr_ui.py): `ocr/ocr_ui.py`
- [OCR evaluation](https://github.com/hynanhat/autoblog/blob/main/ocr/evaluate.py): `ocr/evaluate.py`

### Other components

- **Operator**
- **Shinobi Blog**
- **Google Gemini**

## Connections

- Operator → Desktop GUI: configures jobs (evidence: `README.md`)
- Desktop GUI → Input parsers: parses inputs (evidence: `app.py`)
- Desktop GUI → Browser runner: starts worker (evidence: `app.py`)
- Browser runner → Captcha capture: captures captcha (evidence: `ninja_worker.py`)
- Browser runner → Account setup: creates accounts (evidence: `README.md`)
- Browser runner → Domain selection: selects domain (evidence: `README.md`)
- Browser runner → Article publishing: publishes HTML (evidence: `ninja_worker.py`)
- Account setup → Shinobi Blog: registers on (evidence: `README.md`)
- Domain selection → Shinobi Blog: checks domains (evidence: `README.md`)
- Article publishing → Shinobi Blog: publishes to (evidence: `README.md`)
- Browser runner → Captcha solver: requests solution (evidence: `ninja_worker.py`)
- Captcha solver → OCR HTTP client: tries OCR (evidence: `hiragana_hook.py`)
- Captcha solver → Operator: falls back to (evidence: `hiragana_hook.py`)
- OCR HTTP client → Image inbox: writes images (evidence: `README.md`)
- OCR HTTP client → OCR API server: polls results (evidence: `README.md`)
- OCR API server → Job store: reads jobs (evidence: `ocr/server.py`)
- OCR API server → Gemini recognition: runs recognition (evidence: `ocr/server.py`)
- Gemini recognition → API key pool: uses keys (evidence: `ocr/ocr_service.py`)
- Gemini recognition → Google Gemini: recognizes with (evidence: `README.md`)
- Gemini recognition → Hiragana formatter: formats output (evidence: `ocr/ocr_service.py`)
- Image inbox → Image preprocessing: processes images (evidence: `README.md`)
- OCR review UI → Gemini recognition: tests readings (evidence: `ocr/ocr_ui.py`)
- OCR review UI → Image preprocessing: previews cleanup (evidence: `ocr/ocr_ui.py`)
- OCR evaluation → Gemini recognition: compares readings (evidence: `ocr/evaluate.py`)
- OCR evaluation → Image preprocessing: compares variants (evidence: `ocr/evaluate.py`)
