pub struct MapsScraper { /* private fields */ }Expand description
The scraper. Holds an active Chrome browser process.
Drop the scraper to close Chrome.
Implementations§
Source§impl MapsScraper
impl MapsScraper
Sourcepub async fn launch(cfg: ScraperConfig) -> Result<Self>
pub async fn launch(cfg: ScraperConfig) -> Result<Self>
Launch (or connect to) a Chrome browser and return a ready-to-use scraper.
If ScraperConfig::browserless_url is set (or the BROWSERLESS_URL
environment variable is present), this connects to that remote Chrome
over the DevTools WebSocket instead of launching a local browser — handy
when no local Chrome is available or for high-volume scraping through a
managed Chrome service.
Sourcepub async fn search(&self, query: &str) -> Result<Vec<Place>>
pub async fn search(&self, query: &str) -> Result<Vec<Place>>
Run a single Google Maps text search and return the extracted places.
§Performance
Each call opens a fresh Chrome tab, visits the Maps homepage (consent
dismissal, including a fixed ~3 s settle delay), runs the one query, and
closes the tab. Calling this in a loop pays that per-call setup N times.
For multiple queries prefer MapsScraper::search_many, which reuses
one tab for all of them.