Tabela de Conteúdos
Google Maps Scraping In Pure Python
Raspar o Google Maps requer bons conhecimentos de codificação, emulação de navegador, proxies, e reCAPTCHA solver. Além disso, você também deve estar pronto para lidar com as mudanças que o Google possa fazer em seu conteúdo dinâmico.
First of all, you will need to mimic the real user’s behavior by using browser emulation. Using Selênio or other browser emulators might be a good solution.
Secondly, if you want to keep your office/home IP safe you will need to use procuradores. So you can request websites from other people’s IPs.
Even with that set of tools, once you have some good usage, Google might show you reCAPTCHA and bind it to some of your IPs. If you do not want to change IPs every time you see a reCAPTCHA, you can add a reCAPTCHA solver.
Additionally, be prepared for situations when Google might change its content. You can do it by running daily tests.
Although it might take some time to implement the scraper, it can be built and maintained. Check out this step-by-step tutorial on how to scrape Google Maps using Python and Selenium to learn more: Como Raspar Google Maps com Python e Selenium.
Google Maps Scraping With Outscraper Python Package
A more simple and reliable way of scraping Google Maps will be using the Outscraper python library. Ele fornece acesso conveniente ao Outscraper API from applications written in the Python language which allows you to use Serviços do Outscraper de seu código.
Você pode começar instalando o pacote e criação de uma conta em Outscraper.

Instalação
Install the Outscraper SDK by running the following command (Python 3+ is required):
pip install outscraper
Inicialização
Inicialize o cliente Outscraper, importando a classe e adicionando sua chave secreta API. Você pode gerar a chave API em a página do perfil.
from outscraper import ApiClient
client = ApiClient(api_key='SECRET_API_KEY')
Exemplos de uso
Aqui estão exemplos de como você pode raspar lugares do Google Maps usando as consultas de busca:
# Search for businesses in specific locations:
results = client.google_maps_search_v2(['restaurants brooklyn usa'], limit=20, language='en', region='us')
# Scrap Places by Two Queries
results = client.google_maps_search_v2(
['restaurants brooklyn usa', 'bars brooklyn usa'],
limit=50, # limit of palces per each query
language='en',
region='US',
)
# Iterate over the results
for query_places in results:
for place in query_places:
print('query:', place['query'])
print('name:', place['name'])
print('phone:', place['phone'])
print('website:', place['site'])
Também é possível extrair os dados usando o Place Id:
# Get data of the specific place by id
results = client.google_maps_search_v2(['ChIJrc9T9fpYwokRdvjYRHT8nI4'], language='en')
# Scrap Places by Place Ids
results = client.google_maps_search_v2(
["ChIJ8ccnM7dbwokRy-pTMsdgvS4", "ChIJN5X_gWdZwokRck9rk2guJ1M", "ChIJxWLy8DlawokR1jvfXUPSTUE"],
limit=1, # limit of palces per each query
)
# Iterate over the results
for query_places in results:
for place in query_places:
print('name:', place['name'])
print('place_id:', place['place_id'])
Experimente agora o Outscraper SDK
The Outscraper SDK is available for you to easily do Google Maps Scraping with Python. You can try it right now with a Free Tier.
Você pode raspar os resultados do Google Map usando o Outscraper SDK. Especifique as consultas de busca, idioma e outros parâmetros e envie sua solicitação.
pip install outscraper
from arranha-céu import ApiClient client = ApiClient(api_key='SECRET_API_KEY')
# Search for businesses in specific locations: results = client.google_maps_search('restaurants brooklyn usa', limit=20, language='en') # Get data of the specific place by id results = client.google_maps_search('ChIJrc9T9fpYwokRdvjYRHT8nI4', language='en') # Search with many queries (batching) results = client.google_maps_search([ 'restaurants brooklyn usa', 'bars brooklyn usa', ], language='en')
Raspar o Google Maps requer bons conhecimentos de codificação, emulação de navegador, proxies, e reCAPTCHA solver. Além disso, você também deve estar pronto para lidar com as mudanças que o Google possa fazer em seu conteúdo dinâmico.
Google Maps não permite a raspagem. Embora, a raspagem e a extração de dados públicos seja protegida pela Primeira Emenda da Constituição dos Estados Unidos.
Comentário de 0