> ## Documentation Index
> Fetch the complete documentation index at: https://docs.brightdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Google 爬虫快速开始

> 在 5 分钟内设置 Bright Data Google 爬虫 API 并收集你的第一个 Google 地图地点。

本教程向你展示如何使用 Bright Data Google 爬虫 API 抓取 Google 地图地点并获得结构化 JSON 数据。

## 先决条件

* [Bright Data 账户](https://www.bright.cn/products/web-scraper/google?hs_signup=1\&utm_source=docs)（每月含 5,000 个免费积分）
* 已安装 cURL、Python 3 或 Node.js 18+

<Steps>
  <Step title="获取 API 密钥">
    前往 Bright Data 账户中的[用户设置页面](https://www.bright.cn/cp/setting/users)并创建一个 API 密钥，或使用已有的密钥。

    如果你还没有账户，[在 brightdata.com 注册](https://www.bright.cn/products/web-scraper/google?hs_signup=1\&utm_source=docs)。新账户每月可获得 5,000 个免费积分，无需信用卡。请参阅[免费套餐](/cn/general/account/billing-and-pricing/free-tier)。

    <Warning>
      API 密钥仅在创建时显示一次。请复制并安全存储。
    </Warning>
  </Step>

  <Step title="发送请求">
    我们将使用 **Google 地图 - 按 URL 收集**端点的同步请求。将 `YOUR_API_KEY` 替换为你的实际密钥：

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X POST \
        "https://api.brightdata.com/datasets/v3/scrape?dataset_id=gd_m8ebnr0q2qlklc02fz&format=json" \
        -H "Authorization: Bearer YOUR_API_KEY" \
        -H "Content-Type: application/json" \
        -d '[{"url": "https://www.google.com/maps/place/?q=place_id:ChIJS5WVcqWh9YgRHU08rJqLNsQ"}]'
      ```

      ```python Python theme={null}
      import requests

      response = requests.post(
          "https://api.brightdata.com/datasets/v3/scrape",
          params={"dataset_id": "gd_m8ebnr0q2qlklc02fz", "format": "json"},
          headers={
              "Authorization": "Bearer YOUR_API_KEY",
              "Content-Type": "application/json",
          },
          json=[{"url": "https://www.google.com/maps/place/?q=place_id:ChIJS5WVcqWh9YgRHU08rJqLNsQ"}],
      )

      data = response.json()
      if response.status_code == 202:
          print(f"Job running. Snapshot ID: {data['snapshot_id']}")
      else:
          print(data)
      ```

      ```javascript Node.js theme={null}
      const response = await fetch(
        "https://api.brightdata.com/datasets/v3/scrape?dataset_id=gd_m8ebnr0q2qlklc02fz&format=json",
        {
          method: "POST",
          headers: {
            "Authorization": "Bearer YOUR_API_KEY",
            "Content-Type": "application/json",
          },
          body: JSON.stringify([
            { url: "https://www.google.com/maps/place/?q=place_id:ChIJS5WVcqWh9YgRHU08rJqLNsQ" }
          ]),
        }
      );

      const data = await response.json();
      if (response.status === 202) {
        console.log(`Job running. Snapshot ID: ${data.snapshot_id}`);
      } else {
        console.log(data);
      }
      ```
    </CodeGroup>

    您应该看到 `200` 状态码和一个 JSON 数组。`202` 表示抓取需要超过 1 分钟，请参阅下方说明。处理时间取决于目标网站状况和爬虫负载。

    <Note>
      同步请求最多等待 1 分钟。如果 Bright Data Google Scraper API 需要更长时间，响应为 HTTP `202`，返回 `snapshot_id` 而不是结果数据，采集将继续以异步方式进行。请通过[异步工作流](/cn/products/scrapers/scrapers-library/async-requests)获取结果，或使用 [Webhook 投递](/cn/products/scrapers/scrapers-library/data-delivery)接收结果。
    </Note>
  </Step>

  <Step title="查看响应">
    Bright Data Google 爬虫 API 返回一个包含结构化地点数据的 JSON 数组：

    ```json theme={null}
    [
      {
        "place_id": "ChIJS5WVcqWh9YgRHU08rJqLNsQ",
        "name": "The***s",
        "address": "5155 Peachtree Pkwy NW, Peachtree Corners, GA 30092, United States",
        "category": "Shopping mall",
        "rating": 4.6,
        "reviews_count": 5066,
        "open_hours": {
          "Sunday": "12–6 PM",
          "Saturday": "10 AM–9 PM",
          "Friday": "10 AM–9 PM",
          "Thursday": "10 AM–9 PM",
          "Wednesday": "10 AM–9 PM",
          "Tuesday": "10 AM–9 PM",
          "Monday": "10 AM–9 PM"
        },
        "url": "https://www.google.com/maps/place/The+Forum+Peachtree+Corners/@33.9808771,-84.2175823,17z/data=!3m1!4b1!4m6!3m5!1s0x88f5a1a57295954b:0xc4368b9aac3c4d1d!8m2!3...",
        "country": "United States",
        "description": "Outdoor mall with a European feel & a collection of upscale chains & boutiques, plus restaurants."
      }
    ]
    ```

    每个地点对象包括位置详情、评分、营业时间、照片和联系信息。
  </Step>
</Steps>

你已成功使用 Bright Data Google 爬虫 API 抓取了你的第一个 Google 地图地点。

## 必须直接调用 API 吗？

不必。Bright Data 的 SDK、CLI 和编程代理工具调用的是同一个 Scraper API，您可以选择最适合自己技术栈的方式开始。

| 客户端 | 安装 | 第一次调用 |
| :- | :- | :- |
| **Python 和 Node.js SDK** | `pip install brightdata-sdk` 或 `npm install @brightdata/sdk` | 调用 `client.scrape.<platform>.<endpoint>(url="...")`，方法列表见 [Python SDK](/cn/api-reference/SDK) 和 [JavaScript SDK](/cn/api-reference/SDK-JS) |
| **CLI** | `npm install -g @brightdata/cli`，然后 `bdata login` | 先运行 `bdata pipelines list` 查看所有 pipeline 名称，再运行 `bdata pipelines <pipeline> "<url>" --pretty`；详见 [CLI 命令](/cn/products/cli/commands) |
| **编程代理** | `npx skills add brightdata/skills` 安装技能；[Bright Data MCP](/cn/products/mcp-server/overview) 服务器将爬虫作为工具暴露 | 详见[编程代理快速开始](/cn/quickstart-coding-agent) |

## 下一步

<CardGroup cols={3}>
  <Card title="端点" icon="bolt" href="/cn/products/scrapers/google/send-first-request">
    每个端点一个请求，附实际抓取的响应。
  </Card>

  <Card title="异步批量请求" icon="layer-group" href="/cn/products/scrapers/scrapers-library/async-requests">
    在单个批处理任务中爬取数千个地点或运行发现。
  </Card>

  <Card title="API 参考" icon="code" href="/cn/api-reference/scrapers/search-engines-apis/google-maps-collect-by-url">
    端点规范、参数和响应架构。
  </Card>
</CardGroup>
