# meryarsoy/googlemapsbot architecture

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

- Interactive diagram: https://gitdiagram.com/meryarsoy/googlemapsbot
- Repository: https://github.com/meryarsoy/googlemapsbot

## Overview

Google Maps Scraper is a Flask-based tool for searching businesses by keyword and region, collecting valid Turkish mobile numbers, and exporting them as Google Contacts CSV. The main workflow runs from the web panel through task handling and background scraping to a cumulative CSV; a separate command-line entry point also runs searches. The graph preserves documented capabilities such as query expansion, district selection, live progress, and duplicate filtering. Some app and scraper excerpts are partial, so edges to unsampled behavior rely only on README documentation.

Main entry points: [`app.py`](https://github.com/meryarsoy/googlemapsbot/blob/main/app.py) (Task worker), [`scraper.py`](https://github.com/meryarsoy/googlemapsbot/blob/main/scraper.py) (Maps scraper), [`templates/index.html`](https://github.com/meryarsoy/googlemapsbot/blob/main/templates/index.html) (Web panel), [`main.py`](https://github.com/meryarsoy/googlemapsbot/blob/main/main.py) (CLI searches)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_panel["Web panel"]
  node_panel_ui["Web panel<br/>[index.html]"]
  node_web_api["Task and lookup API<br/>[app.py]"]
end

subgraph group_tasks["Task processing"]
  node_task_state["Task history<br/>[app.py]"]
  node_task_queue["Background queue<br/>[app.py]"]
  node_task_worker["Task worker<br/>[app.py]"]
  node_search_setup["Search setup<br/>[app.py]"]
  node_cli["CLI searches<br/>[main.py]"]
end

subgraph group_collection["Maps collection"]
  node_query_builder["Query expansion<br/>[scraper.py]"]
  node_maps_scraper["Maps scraper<br/>[scraper.py]"]
  node_result_processing["Result filtering<br/>[scraper.py]"]
end

node_user(("Operator"))
node_maps["Google Maps"]
node_contacts_csv["Contacts CSV"]

node_user -->|"submits searches"| node_panel_ui
node_panel_ui -->|"uses endpoints"| node_web_api
node_web_api -->|"queues tasks"| node_task_queue
node_web_api -->|"updates status"| node_task_state
node_task_worker -->|"takes tasks"| node_task_queue
node_task_worker -->|"prepares searches"| node_search_setup
node_search_setup -->|"expands queries"| node_query_builder
node_task_worker -->|"runs searches"| node_maps_scraper
node_cli -->|"runs searches"| node_maps_scraper
node_maps_scraper -->|"searches and scrolls"| node_maps
node_maps_scraper -->|"processes cards"| node_result_processing
node_result_processing -->|"appends contacts"| node_contacts_csv
node_task_worker -->|"saves history"| node_task_state
node_task_state -->|"provides progress"| node_panel_ui

click node_panel_ui "https://github.com/meryarsoy/googlemapsbot/blob/main/templates/index.html"
click node_web_api "https://github.com/meryarsoy/googlemapsbot/blob/main/app.py"
click node_task_state "https://github.com/meryarsoy/googlemapsbot/blob/main/app.py"
click node_task_queue "https://github.com/meryarsoy/googlemapsbot/blob/main/app.py"
click node_task_worker "https://github.com/meryarsoy/googlemapsbot/blob/main/app.py"
click node_search_setup "https://github.com/meryarsoy/googlemapsbot/blob/main/app.py"
click node_cli "https://github.com/meryarsoy/googlemapsbot/blob/main/main.py"
click node_query_builder "https://github.com/meryarsoy/googlemapsbot/blob/main/scraper.py"
click node_maps_scraper "https://github.com/meryarsoy/googlemapsbot/blob/main/scraper.py"
click node_result_processing "https://github.com/meryarsoy/googlemapsbot/blob/main/scraper.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_panel_ui,node_web_api toneBlue
class node_task_state,node_task_queue,node_task_worker,node_search_setup,node_cli toneAmber
class node_query_builder,node_maps_scraper,node_result_processing toneMint
class node_user,node_maps,node_contacts_csv toneIndigo
```

## Components

### Web panel

- [Web panel](https://github.com/meryarsoy/googlemapsbot/blob/main/templates/index.html): `templates/index.html`
- [Task and lookup API](https://github.com/meryarsoy/googlemapsbot/blob/main/app.py): `app.py`

### Task processing

- [Task history](https://github.com/meryarsoy/googlemapsbot/blob/main/app.py): `app.py`
- [Background queue](https://github.com/meryarsoy/googlemapsbot/blob/main/app.py): `app.py`
- [Task worker](https://github.com/meryarsoy/googlemapsbot/blob/main/app.py): `app.py`
- [Search setup](https://github.com/meryarsoy/googlemapsbot/blob/main/app.py): `app.py`
- [CLI searches](https://github.com/meryarsoy/googlemapsbot/blob/main/main.py): `main.py`

### Maps collection

- [Query expansion](https://github.com/meryarsoy/googlemapsbot/blob/main/scraper.py): `scraper.py`
- [Maps scraper](https://github.com/meryarsoy/googlemapsbot/blob/main/scraper.py): `scraper.py`
- [Result filtering](https://github.com/meryarsoy/googlemapsbot/blob/main/scraper.py): `scraper.py`

### Other components

- **Operator**
- **Google Maps**
- **Contacts CSV**

## Connections

- Operator → Web panel: submits searches (evidence: `README.md`)
- Web panel → Task and lookup API: uses endpoints (evidence: `README.md`)
- Task and lookup API → Background queue: queues tasks (evidence: `app.py`)
- Task and lookup API → Task history: updates status (evidence: `app.py`)
- Task worker → Background queue: takes tasks (evidence: `app.py`)
- Task worker → Search setup: prepares searches (evidence: `app.py`)
- Search setup → Query expansion: expands queries (evidence: `README.md`)
- Task worker → Maps scraper: runs searches (evidence: `README.md`)
- CLI searches → Maps scraper: runs searches (evidence: `main.py`)
- Maps scraper → Google Maps: searches and scrolls (evidence: `scraper.py`)
- Maps scraper → Result filtering: processes cards (evidence: `scraper.py`)
- Result filtering → Contacts CSV: appends contacts (evidence: `scraper.py`)
- Task worker → Task history: saves history (evidence: `app.py`)
- Task history → Web panel: provides progress (evidence: `README.md`)
