# boaz-maroko/bet_scrapper architecture

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

- Interactive diagram: https://gitdiagram.com/boaz-maroko/bet_scrapper
- Repository: https://github.com/boaz-maroko/bet_scrapper

## Overview

bet_scrapper is a Telegram bot that polls Bangbet for same-day football matches and odds, tracks changes, and reports them to chats. The sampled source shows match and Over/Under retrieval, odds-change formatting, monitoring, Telegram command registration, and a FastAPI webhook. Some handler and initialization details are in omitted excerpts, so their internal wiring is not expanded.

Main entry points: [`main.py`](https://github.com/boaz-maroko/bet_scrapper/blob/main/main.py) (Monitoring loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["Webhook service"]
  node_fastapi["FastAPI app<br/>[main.py]"]
  node_webhook["Update webhook<br/>[main.py]"]
  node_health["Health endpoint<br/>[main.py]"]
end

subgraph group_bot["Telegram bot"]
  node_bot_app["Bot application<br/>[main.py]"]
  node_commands["Start / stop handlers<br/>[main.py]"]
end

subgraph group_odds["Odds monitoring"]
  node_monitor["Monitoring loop<br/>[main.py]"]
  node_match_fetch["Match fetcher<br/>[main.py]"]
  node_ou_fetch["Over/Under fetcher<br/>[main.py]"]
  node_change_format["Change formatter<br/>[main.py]"]
  node_tracked_matches[("Tracked matches<br/>[main.py]")]
end

node_telegram_user(("Telegram user"))
node_telegram_api["Telegram API"]
node_bangbet["Bangbet API"]

node_telegram_user -->|"sends updates"| node_telegram_api
node_telegram_api -->|"posts updates"| node_webhook
node_webhook -->|"handled by"| node_fastapi
node_webhook -->|"processes update"| node_bot_app
node_bot_app -->|"dispatches commands"| node_commands
node_fastapi -->|"serves status"| node_health
node_commands -->|"controls monitoring"| node_monitor
node_monitor -->|"fetches matches"| node_match_fetch
node_monitor -->|"fetches odds"| node_ou_fetch
node_match_fetch -->|"requests matches"| node_bangbet
node_ou_fetch -->|"requests odds"| node_bangbet
node_monitor -->|"formats changes"| node_change_format
node_monitor -->|"reads and updates"| node_tracked_matches
node_monitor -->|"sends reports"| node_telegram_api

click node_fastapi "https://github.com/boaz-maroko/bet_scrapper/blob/main/main.py"
click node_webhook "https://github.com/boaz-maroko/bet_scrapper/blob/main/main.py"
click node_health "https://github.com/boaz-maroko/bet_scrapper/blob/main/main.py"
click node_bot_app "https://github.com/boaz-maroko/bet_scrapper/blob/main/main.py"
click node_commands "https://github.com/boaz-maroko/bet_scrapper/blob/main/main.py"
click node_monitor "https://github.com/boaz-maroko/bet_scrapper/blob/main/main.py"
click node_match_fetch "https://github.com/boaz-maroko/bet_scrapper/blob/main/main.py"
click node_ou_fetch "https://github.com/boaz-maroko/bet_scrapper/blob/main/main.py"
click node_change_format "https://github.com/boaz-maroko/bet_scrapper/blob/main/main.py"
click node_tracked_matches "https://github.com/boaz-maroko/bet_scrapper/blob/main/main.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_fastapi,node_webhook,node_health,node_telegram_user toneBlue
class node_bot_app,node_commands toneAmber
class node_monitor,node_match_fetch,node_ou_fetch,node_change_format,node_tracked_matches,node_telegram_api,node_bangbet toneMint
```

## Components

### Webhook service

- [FastAPI app](https://github.com/boaz-maroko/bet_scrapper/blob/main/main.py): `main.py`
- [Update webhook](https://github.com/boaz-maroko/bet_scrapper/blob/main/main.py): `main.py`
- [Health endpoint](https://github.com/boaz-maroko/bet_scrapper/blob/main/main.py): `main.py`

### Telegram bot

- [Bot application](https://github.com/boaz-maroko/bet_scrapper/blob/main/main.py): `main.py`
- [Start / stop handlers](https://github.com/boaz-maroko/bet_scrapper/blob/main/main.py): `main.py`

### Odds monitoring

- [Monitoring loop](https://github.com/boaz-maroko/bet_scrapper/blob/main/main.py): `main.py`
- [Match fetcher](https://github.com/boaz-maroko/bet_scrapper/blob/main/main.py): `main.py`
- [Over/Under fetcher](https://github.com/boaz-maroko/bet_scrapper/blob/main/main.py): `main.py`
- [Change formatter](https://github.com/boaz-maroko/bet_scrapper/blob/main/main.py): `main.py`
- [Tracked matches](https://github.com/boaz-maroko/bet_scrapper/blob/main/main.py): `main.py`

### Other components

- **Telegram user**
- **Telegram API**
- **Bangbet API**

## Connections

- Telegram user → Telegram API: sends updates
- Telegram API → Update webhook: posts updates
- Update webhook → FastAPI app: handled by
- Update webhook → Bot application: processes update
- Bot application → Start / stop handlers: dispatches commands
- FastAPI app → Health endpoint: serves status
- Start / stop handlers → Monitoring loop: controls monitoring
- Monitoring loop → Match fetcher: fetches matches
- Monitoring loop → Over/Under fetcher: fetches odds
- Match fetcher → Bangbet API: requests matches
- Over/Under fetcher → Bangbet API: requests odds
- Monitoring loop → Change formatter: formats changes
- Monitoring loop → Tracked matches: reads and updates
- Monitoring loop → Telegram API: sends reports
