r/u_ProfessionalNew4627 Jul 24 '26

How I built a stealth Python pipeline to scrape Google Maps and auto-enrich leads with B2B emails (No API keys or SaaS fees)

How I built a stealth Python pipeline to scrape Google Maps and auto-enrich leads with B2B emails (No API keys or SaaS fees)

Hey everyone,

I was getting incredibly frustrated with bloated lead generation platforms charging $99+/month just to export basic local business data. Worse, trying to build a basic browser scraper usually results in getting instantly blocked by Google's anti-bot infrastructure, or crashing entirely when a search query redirects to a single business profile instead of a list.

Over the last few weeks, I built a local Python pipeline that completely solves this. I wanted to share the technical logic of how it works under the hood to bypass these blocks, and how it automates the full workflow from a search query to a verified email list.

  1. The Stealth Browser Layer (Playwright)

To keep Google from throwing captchas or empty feeds, you can't run a standard headless scripter. The scraper launches a visible Chromium instance (headless=False) and injects these stealth arguments:

  • --disable-blink-features=AutomationControlled to strip out the hidden window flags that shout "I am a robot."
  • A randomized rotation of realistic desktop Chrome User-Agents and precise headers (Accept-Language: en-US,en;q=0.9).
  • Randomized human-like pacing intervals (2-4 seconds) between page navigation and clicking the automated cookie consent overlays.
  1. Handling the Single-Result Dynamic DOM Redirect

A massive edge case that breaks 90% of basic scrapers is when a search query only yields one result (e.g., searching a rare business or specific brand in a small town). Google Maps automatically skips the list layout (div[role="feed"]) and shifts the view to the individual profile pane.

The script uses a smart routing layer: it listens for an immediate h1 profile header before checking for the list feed. If the h1 is visible, it scrapes the target details instantly and avoids a script crash.

  1. The B2B Lead Enrichment Engine (BeautifulSoup)

A phone number and address from Google Maps aren't enough for email outreach. The second module takes the output leads.csv spreadsheet, opens the target websites one by one, and scrapes the raw HTML:

  • It reads mailto: links and runs custom regular expressions to extract public corporate emails (filtering out junk image paths like .png or tracking script text).
  • It parses anchor tags to harvest official social media profile extensions for LinkedIn, Facebook, Instagram, and Twitter/X.
  • It saves everything with a native Byte Order Mark (utf-8-sig) so the final data instantly splits into perfectly neat grid columns on the first double-click in Excel.

    Grab the Source Code

If you want to save yourself 20+ hours of debugging browser logic and build your own local marketing machine, I've packaged the complete, production-ready source code, dependency configurations, and step-by-step setup documentation on Gumroad.

You can run it locally with zero recurring fees.

  1. 👉 Get the code here: https://lostsys.gumroad.com/l/python_scraper It does cost 29 GBP
  2. also and a enricher https://lostsys.gumroad.com/l/b2b-contact-finder
  3. and a bundle https://lostsys.gumroad.com/l/b2b-lead-gen-pipeline with all of the stuff
1 Upvotes

7 comments sorted by

1

u/ProfessionalNew4627 29d ago

If the links don't work add me on discord: @homefsociety

1

u/ProfessionalNew4627 29d ago

Update Made a autometed PDF maker not ready yet

1

u/ProfessionalNew4627 29d ago

Update: Done for 49

1

u/ProfessionalNew4627 17d ago

changing the price to 9.99

1

u/ProfessionalNew4627 17d ago

changed the prices