Free, open-source Google Maps scraper for lead generation (Python, no API key, no Docker). Exports name, phone, email, website, rating and Instagram/Facebook/LinkedIn/TikTok/YouTube/X links to CSV. 100 places with emails in 44 s; --grid beats Google's 120 cap. MX email check, ad-pixel detection. Skill for Claude Code, Codex and Cursor.
Python agent-skillsb2b-leadsclaude-codeclaude-skillscodex-skillsemail-extractoremail-scrapergoogle-mapsgoogle-maps-extractorgoogle-maps-leadsgoogle-maps-scrapergoogle-maps-scraper-pythongoogle-maps-scrapinggooglemaps-scraperheadless-chromelead-generationlead-scraperno-api-keypythonweb-scraping
Merge branch 'feat/preset-search' into fix/v2-parity
Mahan Jafari828cf0b515f7
diff --cc engine/serve.pyindex 1646933,1540485..696bb33--- a/engine/serve.py+++ b/engine/serve.py@@@ -15,7 -15,7 +15,7 @@@ Google Maps, for email or socials jobsto Google's public DNS (dns.google), nothing else.Standard library only."""- import argparse, csv, hmac, html, io, json, os, re, secrets, signal, socket, socketserver, sqlite3, sys, threading, unicodedata-import argparse, csv, gzip, hmac, html, io, json, os, re, secrets, signal, socket, socketserver, sys, threading, unicodedata++import argparse, csv, gzip, hmac, html, io, json, os, re, secrets, signal, socket, socketserver, sqlite3, sys, threading, unicodedataimport urllib.parsefrom http.server import BaseHTTPRequestHandler, ThreadingHTTPServer@@@ -59,14 -61,48 +61,52 @@@ def file_name(job, jid)return (re.sub(r"[^a-z0-9]+", "-", s).strip("-")[:60] or "results") + "-" + jid[:8]+ FOLD = str.maketrans({"ł": "l", "ø": "o", "đ": "d", "ı": "i", "ß": "ss", "æ": "ae", "œ": "oe", "þ": "th"})+++ def fold(s):+ """"sao paulo sp br" for "São Paulo, SP, BR": accents dropped (also ł, ø, ı...), lower case, punctuation+ as single spaces."""+ s = "".join(c for c in unicodedata.normalize("NFKD", s.lower().translate(FOLD)) if not unicodedata.combining(c))+ return " ".join(re.sub(r"[\W_]+", " ", s).split())+++ def cities():+ """Every city as one "folded label<TAB>label<TAB>lat<TAB>lon<TAB>country" line, biggest first. Read on the+ first lookup, then kept (about 35 MB)."""+ global _cities+ with _cities_lock:+ if _cities is None:+ rows = []+ with gzip.open(os.path.join(PRESETS, "cities.tsv.gz"), "rt", encoding="utf-8") as f:+ for line in f:+ name, admin, cc, lat, lon = line.rstrip("\n").split("\t")+ label = ", ".join([name] + ([admin] if admin and admin != name else []) + [cc])+ rows.append("\t".join((fold(label), label, lat, lon, cc)))+ _cities = rows+ return _cities+++ def find_cities(q, limit=20):+ """The biggest cities whose "name, region, country" starts with q; with no q, the biggest in the US."""+ q, out = fold(q), []+ for row in cities(): # ponytail: a linear scan, about 30 ms; a prefix index if lookups ever lag+ if row.startswith(q) if q else row.endswith("\tUS"):+ _, label, lat, lon, cc = row.split("\t")+ out.append({"label": label, "lat": lat, "lon": lon, "country": cc})+ if len(out) == limit:+ break+ return out++def log(msg):- """One line on stderr with a UTC timestamp and its offset. Counts only, never scraped values."""+ """One line on stderr with a UTC timestamp and its offset. Counts only, never scraped values.+ A log that cannot be written (full disk, closed stderr) is dropped, never raised."""with _log_lock:- print(f"{jobs.utc_now()} {msg}", file=sys.stderr, flush=True)+ try:+ print(f"{jobs.utc_now()} {msg}", file=sys.stderr, flush=True)+ except (OSError, ValueError):+ passdef env_value(v):