跳转到主要内容

Google Maps Scraper,用于收集各种Google Maps列表中的数据,包括商业资料。

项目描述

Google Maps Scraper

Oxylabs promo code

Google Maps Scraper使您能够轻松地从Google Maps和Google Places提取具有地理参考的公开数据。本简短指南将向您展示使用Oxylabs Scraper API抓取Google Maps的过程。

工作原理

您可以通过向我们服务提供URL来检索Google Maps数据。我们的API将以JSON格式返回结果。

Python代码示例

以下代码示例演示了如何获取Google Maps结果。首先,您需要使用推拉方法将指令发送到我们的服务

import requests
from pprint import pprint

# Structure payload.
payload = {
    'source': 'google',
    'url': 'https://www.google.com/maps/search/restaurants/@40.7660158,-73.9833944,14z/data=!4m5!2m4!5m2!1e0!4e9!6e5?entry=ttu',
    'geo_location': 'New York,New York,United States',
    'render': 'html'
}

# Get response.
response = requests.request(
    'POST',
    'https://data.oxylabs.io/v1/queries',
    auth=('USERNAME', 'PASSWORD'),
    json=payload
)

# This will return a response with job status and results url.
pprint(response.json())

一旦任务完成,您可以通过发出另一个请求并包含上一个响应中的作业ID来检索结果,例如

import requests

# Get response.
response = requests.request(
    'GET',
    'http://data.oxylabs.io/v1/queries/{job_id}/results',
    auth=('USERNAME', 'PASSWORD')
)

# This will return the JSON response with results.
print(response.json())

输出示例

上面的代码片段将检索JSON格式的结果

{
    "results": [
        {
            "content": "<!doctype html>
<html lang="en">
<head>...</script></body>
</html>
",
            "created_at": "2023-07-25 10:01:01",
            "job_id": "7089545068712824833",
            "page": 1,
            "status_code": 200,
            "updated_at": "2023-07-25 10:01:20",
            "url": "https://www.google.com/maps/search/restaurants/@40.7660158,-73.9833944,14z/data=!4m5!2m4!5m2!1e0!4e9!6e5?entry=ttu"
        }
    ]
}

从本地地标到各种商业,使用Oxylabs的Google Maps Scraper,您将轻松访问所需的公开数据。如果您有任何问题或需要帮助,请随时通过聊天或电子邮件联系我们的24/7支持团队。

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码分发

google-maps-scraper-api-0.1.0.tar.gz (3.4 kB 查看哈希值)

上传时间 源代码

构建分发

google_maps_scraper_api-0.1.0-py3-none-any.whl (2.8 kB 查看哈希值)

上传时间 Python 3

支持者