Google Maps Automation Scraper Skill
📖 Introduction
This skill leverages BrowserAct's Google Maps API template to provide a one-stop business data collection service. It extracts structured details directly from Google Maps, including business names, categories, contact info, ratings, and more. Simply provide the search keywords and location bias to get clean, actionable data.
✨ Features
- 1. No Hallucinations: Pre-set workflows avoid AI generative hallucinations, ensuring stable and precise data extraction.
- No Captcha Issues: No need to handle reCAPTCHA or other verification challenges.
- No IP Restrictions: No need to handle regional IP restrictions or geofencing.
- Faster Execution: Tasks execute faster compared to pure AI-driven browser automation solutions.
- Cost-Effective: Significantly lowers data acquisition costs compared to high-token-consuming AI solutions.
🔑 API Key Setup
Before running, check the
BROWSERACT_API_KEY environment variable. If not set, do not take other measures; ask and wait for the user to provide it.
Agent must inform the user:
"Since you haven't configured the BrowserAct API Key, please visit the BrowserAct Console to get your Key."
🛠️ Input Parameters
Configure the following parameters based on user requirements:
- 1. keywords (Search Keywords)
-
Type:
string
-
Description: The query you would search for on Google Maps.
-
Example:
coffee shop,
dental clinic, INLINECODE4
- 2. language (UI Language)
-
Type:
string
-
Description: Defines the UI language and returned text language (e.g., en, zh-CN).
-
Default: INLINECODE6
- 3. country (Country Bias)
-
Type:
string
-
Description: Specifies the country or region bias (e.g., us, gb, ca).
-
Default: INLINECODE8
🚀 Usage
Execute the following script to get results in one command:
CODEBLOCK0
⏳ Execution Monitoring
Since this task involves automated browser operations, it may take some time (several minutes). The script will
continuously output status logs with timestamps (e.g.,
[14:30:05] Task Status: running).
Agent Instructions:
- - While waiting for the script result, keep monitoring the terminal output.
- As long as the terminal is outputting new status logs, the task is running normally; do not mistake it for a deadlock or unresponsiveness.
- Only if the status remains unchanged for a long time or the script stops outputting without returning a result should you consider triggering the retry mechanism.
📊 Data Output
Upon success, the script parses and prints the following fields from the API:
- -
Title Name: Official business name - INLINECODE11 : Main business category
- INLINECODE12 : Full street address
- INLINECODE13 : Contact phone number
- INLINECODE14 : Official URL
- INLINECODE15 : Average star rating
- INLINECODE16 : Total number of reviews
- INLINECODE17 : Operational status (e.g., operational)
⚠️ Error Handling & Retry
If an error occurs during script execution (e.g., network fluctuations or task failure), the Agent should follow this logic:
- 1. Check Output Content:
- If the output
contains "Invalid authorization", it means the API Key is invalid or expired.
Do not retry; guide the user to re-check and provide the correct API Key.
- If the output
does not contain "Invalid authorization" but the task failed (e.g., output starts with
Error: or returns empty results), the Agent should
automatically try to re-execute the script once.
- 2. Retry Limit:
- Automatic retry is limited to
one time. If the second attempt fails, stop retrying and report the specific error information to the user.
🌟 Typical Use Cases
- 1. Lead Generation: Find "SaaS companies" in "us" for sales outreach.
- Competitor Research: Extract data on "coffee shops" in a specific neighborhood.
- Market Analysis: Identify the density of "dental clinics" in a region.
- Contact Info Retrieval: Get phone numbers and websites for "real estate agencies".
- Local Service Discovery: Find "Turkish-style restaurants" with high ratings.
- Business Status Monitoring: Check if specific stores are "operational".
- Directory Building: Gather addresses and categories for a local business directory.
- Rating Benchmarking: Compare ratings of various "luxury hotels".
- Global Scouting: Research "tech startups" in different countries like "gb" or "au".
- Automated Data Sync: Periodically pull local business data into a CRM.
Google Maps 自动化抓取技能
📖 简介
该技能利用 BrowserAct 的 Google Maps API 模板,提供一站式商业数据采集服务。它直接从 Google Maps 提取结构化详细信息,包括商家名称、类别、联系方式、评分等。只需提供搜索关键词和位置偏好,即可获得清晰、可操作的数据。
✨ 功能特点
- 1. 无幻觉问题:预设工作流程避免 AI 生成幻觉,确保稳定精确的数据提取。
- 无验证码问题:无需处理 reCAPTCHA 或其他验证挑战。
- 无 IP 限制:无需处理区域 IP 限制或地理围栏。
- 执行速度更快:相比纯 AI 驱动的浏览器自动化方案,任务执行更快。
- 成本效益高:相比高 Token 消耗的 AI 方案,显著降低数据获取成本。
🔑 API 密钥设置
运行前,检查 BROWSERACT
APIKEY 环境变量。如果未设置,不要采取其他措施;询问并等待用户提供。
Agent 必须告知用户:
由于您尚未配置 BrowserAct API 密钥,请访问 BrowserAct 控制台 获取您的密钥。
🛠️ 输入参数
根据用户需求配置以下参数:
- 1. keywords(搜索关键词)
-
类型:string
-
描述:在 Google Maps 上搜索的查询内容。
-
示例:咖啡店、牙科诊所、土耳其风味餐厅
- 2. language(界面语言)
-
类型:string
-
描述:定义界面语言和返回文本语言(例如:en、zh-CN)。
-
默认值:en
- 3. country(国家偏好)
-
类型:string
-
描述:指定国家或地区偏好(例如:us、gb、ca)。
-
默认值:us
🚀 使用方法
执行以下脚本,一键获取结果:
bash
示例调用
python -u ./scripts/google
mapsapi.py 关键词 语言 国家
⏳ 执行监控
由于此任务涉及自动化浏览器操作,可能需要一些时间(几分钟)。脚本将
持续输出带有时间戳的状态日志(例如:[14:30:05] 任务状态:运行中)。
Agent 指令:
- - 在等待脚本结果时,持续监控终端输出。
- 只要终端持续输出新的状态日志,任务即正常运行;不要误认为死锁或无响应。
- 仅当状态长时间保持不变或脚本停止输出且未返回结果时,才考虑触发重试机制。
📊 数据输出
成功时,脚本解析并打印 API 返回的以下字段:
- - 标题名称:官方商家名称
- 主要类别:主要业务类别
- 地址:完整街道地址
- 电话号码:联系电话
- 网站链接:官方网站 URL
- 评分:平均星级评分
- 评论数:评论总数
- 营业状态:运营状态(例如:营业中)
⚠️ 错误处理与重试
如果脚本执行过程中发生错误(例如网络波动或任务失败),Agent 应遵循以下逻辑:
- 1. 检查输出内容:
- 如果输出
包含 Invalid authorization,表示 API 密钥无效或已过期。
不要重试;引导用户重新检查并提供正确的 API 密钥。
- 如果输出
不包含 Invalid authorization 但任务失败(例如输出以 Error: 开头或返回空结果),Agent 应
自动尝试重新执行脚本一次。
- 2. 重试限制:
- 自动重试限制为
一次。如果第二次尝试失败,停止重试并向用户报告具体的错误信息。
🌟 典型使用场景
- 1. 潜在客户挖掘:在us寻找SaaS 公司用于销售拓展。
- 竞争对手研究:提取特定区域的咖啡店数据。
- 市场分析:识别某区域牙科诊所的密度。
- 联系方式获取:获取房地产中介的电话和网站。
- 本地服务发现:寻找高评分的土耳其风味餐厅。
- 营业状态监控:检查特定店铺是否营业中。
- 目录构建:收集本地商业目录的地址和类别。
- 评分对标:比较各类豪华酒店的评分。
- 全球调研:研究不同国家(如gb或au)的科技初创公司。
- 自动化数据同步:定期将本地商业数据拉取到 CRM 系统。