# nikolait/googlescraper architecture

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

- Interactive diagram: https://gitdiagram.com/nikolait/googlescraper
- Repository: https://github.com/nikolait/googlescraper

## Overview

GoogleScraper is a Python search-engine results scraper. A user supplies keywords, engines, search type, and mode through the CLI or library; core configures the run and dispatches scraping, which obtains and parses result pages, persists SERPs, and writes JSON/CSV or stdout. It supports blocking HTTP, Selenium, asynchronous HTTP, caching, and proxies. Edges reflect the excerpts, SOURCE INDEX references, or README; connections for unsampled implementation details are omitted.

Main entry points: [`GoogleScraper/core.py`](https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/core.py) (Run coordinator), [`GoogleScraper/scraping.py`](https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/scraping.py) (Scrape lifecycle), [`GoogleScraper/http_mode.py`](https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/http_mode.py) (HTTP mode), [`GoogleScraper/selenium_mode.py`](https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/selenium_mode.py) (Selenium mode)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and configuration"]
  node_cli["Command line<br/>[commandline.py]"]
  node_config["Config loader<br/>[config.py]"]
  node_settings["Default settings<br/>[scrape_config.py]"]
  node_core["Run coordinator<br/>[core.py]"]
  node_jobs["Scrape jobs<br/>[scrape_jobs.py]"]
end

subgraph group_scrape["Scrape execution"]
  node_scrape["Scrape lifecycle<br/>[scraping.py]"]
  node_http["HTTP mode<br/>[http_mode.py]"]
  node_async["Async HTTP<br/>[async_mode.py]"]
  node_selenium["Selenium mode<br/>[selenium_mode.py]"]
end

subgraph group_results["Results and storage"]
  node_parser["SERP parsing<br/>[parsing.py]"]
  node_database[("SERP database<br/>[database.py]")]
  node_output["Output converter"]
  node_cache[("Response cache<br/>[caching.py]")]
end

subgraph group_network["Network support"]
  node_proxies["Proxy management<br/>[proxies.py]"]
  node_agents["User agents<br/>[user_agents.py]"]
  node_socks["SOCKS support<br/>[socks.py]"]
end

node_user(("User"))
node_engines(("Search engines"))
node_browser["Browser drivers"]
node_cachefiles[("Cache files")]
node_outputfile["JSON or CSV"]

node_user -->|"sets options"| node_cli
node_cli -->|"starts run"| node_core
node_core -->|"reads arguments"| node_cli
node_core -->|"loads settings"| node_config
node_config -->|"overrides defaults"| node_settings
node_core -->|"builds jobs"| node_jobs
node_core -->|"dispatches scraping"| node_scrape
node_core -->|"selects mode"| node_http
node_core -->|"selects mode"| node_selenium
node_core -->|"selects mode"| node_async
node_scrape -->|"runs HTTP"| node_http
node_scrape -->|"runs browser"| node_selenium
node_http -->|"parses response"| node_parser
node_async -->|"parses response"| node_parser
node_selenium -->|"sets user agent"| node_agents
node_http -->|"uses user agents"| node_agents
node_http -->|"wraps sockets"| node_socks
node_scrape -->|"selects proxies"| node_proxies
node_core -->|"loads proxies"| node_proxies
node_engines -.->|"serves searches"| node_http
node_engines -.->|"serves searches"| node_browser
node_browser -.->|"drives browser"| node_selenium
node_scrape -->|"stores SERPs"| node_database
node_scrape -->|"stores results"| node_output
node_parser -->|"populates results"| node_database
node_output -->|"reads SERPs"| node_database
node_core -->|"manages cache"| node_cache
node_cache -->|"reads and writes"| node_cachefiles
node_cache -->|"records cached jobs"| node_database
node_output -->|"writes output"| node_outputfile

click node_cli "https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/commandline.py"
click node_config "https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/config.py"
click node_settings "https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/scrape_config.py"
click node_core "https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/core.py"
click node_jobs "https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/scrape_jobs.py"
click node_scrape "https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/scraping.py"
click node_http "https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/http_mode.py"
click node_async "https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/async_mode.py"
click node_selenium "https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/selenium_mode.py"
click node_parser "https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/parsing.py"
click node_database "https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/database.py"
click node_output "https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/output_converter.py"
click node_cache "https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/caching.py"
click node_proxies "https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/proxies.py"
click node_agents "https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/user_agents.py"
click node_socks "https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/socks.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_cli,node_config,node_settings,node_core,node_jobs,node_user,node_browser toneBlue
class node_scrape,node_http,node_async,node_selenium,node_cachefiles toneAmber
class node_parser,node_database,node_output,node_cache toneMint
class node_proxies,node_agents,node_socks toneRose
class node_engines,node_outputfile toneIndigo
```

## Components

### Entry and configuration

- [Command line](https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/commandline.py): `GoogleScraper/commandline.py`
- [Config loader](https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/config.py): `GoogleScraper/config.py`
- [Default settings](https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/scrape_config.py): `GoogleScraper/scrape_config.py`
- [Run coordinator](https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/core.py): `GoogleScraper/core.py`
- [Scrape jobs](https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/scrape_jobs.py): `GoogleScraper/scrape_jobs.py`

### Scrape execution

- [Scrape lifecycle](https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/scraping.py): `GoogleScraper/scraping.py`
- [HTTP mode](https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/http_mode.py): `GoogleScraper/http_mode.py`
- [Async HTTP](https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/async_mode.py): `GoogleScraper/async_mode.py`
- [Selenium mode](https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/selenium_mode.py): `GoogleScraper/selenium_mode.py`

### Results and storage

- [SERP parsing](https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/parsing.py): `GoogleScraper/parsing.py`
- [SERP database](https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/database.py): `GoogleScraper/database.py`
- [Output converter](https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/output_converter.py): `GoogleScraper/output_converter.py`
- [Response cache](https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/caching.py): `GoogleScraper/caching.py`

### Network support

- [Proxy management](https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/proxies.py): `GoogleScraper/proxies.py`
- [User agents](https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/user_agents.py): `GoogleScraper/user_agents.py`
- [SOCKS support](https://github.com/nikolait/googlescraper/blob/master/GoogleScraper/socks.py): `GoogleScraper/socks.py`

### Other components

- **User**
- **Search engines**
- **Browser drivers**
- **Cache files**
- **JSON or CSV**

## Connections

- User → Command line: sets options (evidence: `README.md`)
- Command line → Run coordinator: starts run (evidence: `GoogleScraper/core.py`)
- Run coordinator → Command line: reads arguments (evidence: `GoogleScraper/core.py`)
- Run coordinator → Config loader: loads settings (evidence: `GoogleScraper/core.py`)
- Config loader → Default settings: overrides defaults (evidence: `GoogleScraper/config.py`)
- Run coordinator → Scrape jobs: builds jobs (evidence: `GoogleScraper/core.py`)
- Run coordinator → Scrape lifecycle: dispatches scraping (evidence: `GoogleScraper/core.py`)
- Run coordinator → HTTP mode: selects mode (evidence: `GoogleScraper/core.py`)
- Run coordinator → Selenium mode: selects mode (evidence: `GoogleScraper/core.py`)
- Run coordinator → Async HTTP: selects mode (evidence: `GoogleScraper/core.py`)
- Scrape lifecycle → HTTP mode: runs HTTP (evidence: `GoogleScraper/scraping.py`)
- Scrape lifecycle → Selenium mode: runs browser (evidence: `GoogleScraper/scraping.py`)
- HTTP mode → SERP parsing: parses response (evidence: `GoogleScraper/http_mode.py`)
- Async HTTP → SERP parsing: parses response (evidence: `GoogleScraper/async_mode.py`)
- Selenium mode → User agents: sets user agent (evidence: `GoogleScraper/selenium_mode.py`)
- HTTP mode → User agents: uses user agents (evidence: `GoogleScraper/http_mode.py`)
- HTTP mode → SOCKS support: wraps sockets (evidence: `GoogleScraper/http_mode.py`)
- Scrape lifecycle → Proxy management: selects proxies (evidence: `GoogleScraper/scraping.py`)
- Run coordinator → Proxy management: loads proxies (evidence: `GoogleScraper/core.py`)
- Search engines → HTTP mode: serves searches
- Search engines → Browser drivers: serves searches
- Browser drivers → Selenium mode: drives browser
- Scrape lifecycle → SERP database: stores SERPs (evidence: `GoogleScraper/scraping.py`)
- Scrape lifecycle → Output converter: stores results (evidence: `GoogleScraper/scraping.py`)
- SERP parsing → SERP database: populates results (evidence: `GoogleScraper/parsing.py`)
- Output converter → SERP database: reads SERPs (evidence: `GoogleScraper/output_converter.py`)
- Run coordinator → Response cache: manages cache (evidence: `GoogleScraper/core.py`)
- Response cache → Cache files: reads and writes (evidence: `GoogleScraper/caching.py`)
- Response cache → SERP database: records cached jobs (evidence: `GoogleScraper/caching.py`)
- Output converter → JSON or CSV: writes output (evidence: `GoogleScraper/output_converter.py`)
