diff --git a/implementation/auditing/multi_scraper.py b/implementation/auditing/multi_scraper.py index b3ef609..dcd8986 100644 --- a/implementation/auditing/multi_scraper.py +++ b/implementation/auditing/multi_scraper.py @@ -19,7 +19,7 @@ import os from datetime import datetime, timezone # Ensure scraper is importable -sys.path.insert(0, os.path.expanduser("~/deps/google-maps-scraper/src")) +sys.path.insert(0, "/tmp/google-maps-scraper/src") sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from gmaps_scraper.scraper import GoogleMapsScraper @@ -130,83 +130,57 @@ async def scrape_google(query, coords, business=""): return None -def _valid_phone(num): - """10 US digits, not an all-same-digit placeholder (999-999-9999, the - value call-tracking widgets emit before they're wired).""" - d = re.sub(r"\D", "", num) - return len(d) == 10 and len(set(d)) > 1 - - -def _phone_from_text(text): - """First standalone, non-placeholder US phone number in rendered text. - - Lookarounds reject a phone-like substring glued to other digits (the - raw-HTML path that previously returned JS artifact numbers); - _valid_phone rejects all-same-digit call-tracking placeholders. - """ - for pat in (r"(?, present on JS sites too). - Phone is the NAP-critical field: if the direct HTML has no visible phone, - re-render via Jina Reader, because business sites usually expose the - phone client-side and a false 'no phone' would corrupt the cross-check. - """ + """Extract basic info from business website.""" if not website_url: return None import urllib.request - html = None try: req = urllib.request.Request(website_url, headers={"User-Agent": "Mozilla/5.0"}) with urllib.request.urlopen(req, timeout=10) as resp: html = resp.read().decode("utf-8", errors="replace") - except Exception as e: - print(f" [WARN] Website direct fetch failed ({e}); using Jina Reader") - data = {"source_url": website_url} - if html: - m = re.search(r"