# Malta Business Leads Finder

A Flask web application for discovering publicly listed Malta business leads, scanning business websites for visible email addresses, storing results in SQLite, preventing duplicates, and exporting only email-bearing records.

## Folder structure

```text
BIzLeads/
├── app.py
├── scraper.py
├── export.py
├── database.py
├── launcher.py
├── MaltaBusinessLeadsFinder.spec
├── build.bat
├── install.bat
├── requirements.txt
├── data/
│   └── leads.db          # created automatically on first run
├── templates/
│   ├── index.html
│   └── results.html
└── docs/
    ├── sample-search-screen.svg
    └── sample-results-screen.svg
```

## Features

- Keyword and location search, with Malta as the default location.
- Malta locality optimisation for all 68 Malta and Gozo local councils.
- Multi-threaded website scanning.
- Live progress for businesses found, websites scanned, and emails found.
- SQLite storage with duplicate prevention.
- Business category tagging.
- Automatic Facebook URL discovery from public listings and business websites.
- Email extraction from homepage, contact, and about pages.
- Searchable results table.
- CSV and Excel export containing only records with email addresses.
- Dashboard statistics for total businesses, emails, and scanned websites.
- Modern Bootstrap interface with dark mode.

## Data sources

The app uses OpenStreetMap Overpass data, public business directory result pages where available, and public business websites. Google Maps-style listing support is included through the official Google Places API when `GOOGLE_PLACES_API_KEY` is configured.

## Installation

```bash
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
python app.py
```

Open:

```text
http://127.0.0.1:5000
```

Optional Google Places support:

```bash
set GOOGLE_PLACES_API_KEY=your_api_key_here
python app.py
```

## Windows executable build

Run:

```bat
build.bat
install.bat
```

The installer copies the packaged app to:

```text
%LOCALAPPDATA%\MaltaBusinessLeadsFinder
```

It also creates a desktop shortcut. The end user does not need Python installed. The executable starts the localhost web app, opens the browser automatically, and stores the SQLite database at:

```text
%LOCALAPPDATA%\MaltaBusinessLeadsFinder\data\leads.db
```

More detail is in `DEPLOYMENT.md`.

## Notes

This tool is designed for public business contact research. Websites can block requests, time out, or omit email addresses; those cases are handled without crashing. Always follow applicable privacy, anti-spam, and website terms when using exported contacts.
