विषयसूची
Google Maps Scraping In Pure Python
Scraping Google Maps requires good knowledge of coding, browser emulation, proxies, and a reCAPTCHA हल करने वाला। इसके अतिरिक्त, आपको गूगल द्वारा अपनी गतिशील सामग्री में किए जा सकने वाले परिवर्तनों से निपटने के लिए भी तैयार रहना चाहिए।
First of all, you will need to mimic the real user’s behavior by using browser emulation. Using सेलेनियम 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 प्रॉक्सी. 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 हल करने वाला।
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.
If you are still deciding whether that maintenance work is worth keeping in-house, read our guide on whether to build your own Google Maps scraper or use a managed service.
Check out this step-by-step tutorial on how to scrape Google Maps using Python and Selenium to learn more: पाइथन और सेलेनियम के साथ गूगल मैप्स को कैसे स्क्रैप करें।
Google Maps Scraping With Outscraper Python Package
A more simple and reliable way of scraping Google Maps will be using the Outscraper python library. It provides convenient access to the 1टीपी1टी एपीआई from applications written in the Python language, which allows you to use Outscraper की सेवाएँ आपके कोड से।
आप इंस्टॉल करके शुरू कर सकते हैं। पैकेज और पर एक खाता बनाना आउटस्क्रैपर.

स्थापना
Install the Outscraper SDK by running the following command (Python 3+ is required):
pip install outscraper
आरंभिकीकरण
क्लास को इम्पोर्ट करके और अपनी सीक्रेट API कुंजी जोड़कर Outscraper क्लाइंट को इनिशियलाइज़ करें। आप API कुंजी पर जनरेट कर सकते हैं। प्रोफाइल पेज.
from outscraper import ApiClient
client = ApiClient(api_key='SECRET_API_KEY')
उपयोग के उदाहरण
यहाँ कुछ उदाहरण दिए गए हैं कि आप सर्च क्वेरीज़ का उपयोग करके Google Maps से स्थानों को कैसे स्क्रैप कर सकते हैं:
# 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'])
प्लेस आईडी का उपयोग करके डेटा निकालना भी संभव है:
# 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'])
अभी 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.
आप Outscraper SDK का उपयोग करके Google Map के परिणाम स्क्रैप कर सकते हैं। खोज क्वेरीज़, भाषा और अन्य पैरामीटर निर्दिष्ट करें, और अपना अनुरोध भेजें।
pip install outscraper
से बाहरी वस्तु import ApiClient client = ApiClient(api_key='SECRET_API_KEY')
# Search for businesses in specific locations: परिणाम = client.google_maps_search('restaurants brooklyn usa', limit=20, language='en') # Get data of the specific place by id परिणाम = client.google_maps_search('ChIJrc9T9fpYwokRdvjYRHT8nI4', language='en') # Search with many queries (batching) परिणाम = client.google_maps_search([ 'restaurants brooklyn usa', 'bars brooklyn usa', ], language='en')
Google Maps को स्क्रैप करने के लिए कोडिंग, ब्राउज़र अनुकरण, प्रॉक्सी और का अच्छा ज्ञान आवश्यक है। reCAPTCHA हल करने वाला। इसके अतिरिक्त, आपको गूगल द्वारा अपनी गतिशील सामग्री में किए जा सकने वाले परिवर्तनों से निपटने के लिए भी तैयार रहना चाहिए।
Google Maps स्क्रैपिंग की अनुमति नहीं देता। हालांकि, सार्वजनिक डेटा को स्क्रैप और निकालना संयुक्त राज्य अमेरिका के संविधान की प्रथम संशोधन द्वारा संरक्षित है।
0 Comments