目录

Google Maps Scraping in Pure GO

It is necessary to have a good understanding of coding, browser emulation, proxies, and reCAPTCHA solver in order to scrape Google Maps. Furthermore, you must ensure that you are prepared to deal with any modifications that Google may make to the dynamic information on its website.

You must first utilize browser emulation to simulate the behavior of a valid user. One option is to use  or another browser emulator.

You will need to use 代理人 to protect the IP address associated with your office or home. That way, you can request webpages from the IP addresses of other individuals.

Regardless of the collection of tools, if you have some good usage, Google might show you reCAPTCHA and connect it to some of your IPs. This could happen even if you have a significant amount of traffic. You can add a reCAPTCHA解算器 to your system if you do not wish to alter your IPs each time you encounter a reCAPTCHA.

Also, Google’s content may change. You can do it by running daily tests.

The scraper can be produced and maintained, but gradually. Learn how to scrape Google Maps using Python and Selenium with this tutorial: How to Scrape Google Maps with Python and Selenium.

Google Maps Scraping With Outscraper GO Package​

使用 Outscraper GO library will simplify and improve the reliability of scraping Google Maps. It provides convenient access to the Outscraper API from applications written in the Go language, which allows you to use Outscraper的服务 从你的代码中。

你可以先安装 该包裹 并在以下网站创建一个账户 Outscraper.

安装

Make sure your project is using Go Modules (it will have a go.mod file in its root if it already is):

				
					go mod init
				
			

Install the Outscraper SDK by running the following command.

				
					go get -u github.com/outscraper/outscraper-go
				
			

初始化

通过导入类和添加你的秘密API密钥来初始化Outscraper客户端。你可以在以下网站上生成API密钥 个人资料页面.

				
					package main

import (
	"fmt"
	"github.com/outscraper/outscraper-go"
)

client := outscraper.Client{ApiKey: "SECRET_API_KEY"}
				
			

使用实例

以下是如何通过使用搜索查询从谷歌地图上搜刮地方的例子。

				
					// Search for businesses in specific locations:
results, _ := client.GoogleMapsSearchV2(map[string]string {
	"query": "restaurants brooklyn usa",
	"limit": "20",
  "language": "en",
  "region": "us",
})
fmt.Println(results)
				
			

也可以通过使用地点标识来提取数据。

				
					
// Get data of the specific place by id
results, _ := client.GoogleMapsSearchV2(map[string]string {
	"query": "ChIJrc9T9fpYwokRdvjYRHT8nI4",
  "language": "en",
})
fmt.Println(results)
				
			

现在就试试Outscraper SDK

The Outscraper SDK provides you with a convenient way to easily do Google Maps scraping with Go. You can try it right now with a Free Tier.

常见问题

最常见的问题和答案

你可以通过使用Outscraper SDK刮取谷歌地图结果。指定搜索查询、语言和其他参数,并发送您的请求。

go mod init
go get -u github.com/outscraper/outscraper-go
package main

import (
	"fmt"
	"github.com/outscraper/outscraper-go"
)

client := outscraper.Client{ApiKey: "SECRET_API_KEY"}
// Search for businesses in specific locations:
results, _ := client.GoogleMapsSearchV2(map[string]string {
	"query": "restaurants brooklyn usa",
	"limit": "20",
  "language": "en",
  "region": "us",
})
fmt.Println(results)

刮取谷歌地图需要良好的编码知识、浏览器模拟、代理和 reCAPTCHA解算器。 此外,你也应该准备好应对谷歌可能对其动态内容做出的改变。

谷歌地图不允许搜刮。虽然,搜刮和提取公共数据是受美国宪法第一修正案保护的。

类别: API

尤努斯

市场营销人员、内容写作人员、客户体验开发人员----。 Facebook | 领英 | 推特

0 评论

发表回复

头像占位符