Skip to content

eliagonzalezmolina/google-maps-reviews-scraper

 
 

Repository files navigation

🐈‍⬛ Elia comments

This is a fork from https://github.com/omkarcloud/google-maps-reviews-scraper with small customizations:

  • simplify it to keep only Google reviews context
  • adapt it to poetry
  • adapt it to get params from configuration
  • add some functionalities in Makefile
  • fix style and ensure it with pre-commits

📦 Requirements

To use the tool, you must have Node.js 16+ (https://nodejs.org/) and Python installed on your PC.

🚀 Getting Started

Let's get started by following these super simple steps:

1️⃣ Install Dependencies:

make install

2️⃣ Get the results by running:

make run

Remember to add your params in params.yaml file.

3️⃣ Clean repo:

make clean

4️⃣ Clean repo and results:

make clean_all

5️⃣ Run pre-commits:

make pre-commit

Once the scraping process is complete, you will find the search results in the output directory.

⚠️ Many times Cookies can't be accepted and Exception: Unable to consent Cookies is raised. Try again with a lower max param.

🤔 Questions

❓ How to Scrape a Specific Search Query (also available for multiple queries)?

Open the main.py file, and update the queries list with your desired(s) query.

queries = ["web developers in delhi"]
Gmaps.places(queries, max=5)

❓ The scraper is only retrieving 5 results. How can I scrape all Google Maps search results?

A: Remove the max parameter.

By doing so, you can scrape all the Google Maps Listing. For example, to scrape all web developers in Bangalore, modify the code as follows:

queries = ["web developers in bangalore"]
Gmaps.places(queries)

You can scrape a maximum of 120 results per search, as Google does not display any more search results beyond that. However, don't worry about running out of results as there are thousands of cities in our world :).

❓ How Can I Filter Google Map Search Results?

You can apply filters such as:

  1. min_reviews/max_reviews (e.g., 10)
  2. category_in (e.g., "Dental Clinic", "Dental Laboratory")
  3. has_website (e.g., True/False)
  4. has_phone (e.g., True/False)
  5. min_rating/max_rating (e.g., 3.5)

For instance, to scrape listings with at least 5 reviews and no more than 100 reviews, with a phone number but no website:

Gmaps.places(queries, min_reviews=5, max_reviews=100, has_phone=True, has_website=False)

To scrape listings that belong to specific categories:

Gmaps.places(queries, category_in=[Gmaps.Category.DentalClinic, Gmaps.Category.DentalLaboratory])

See the list of all supported categories here

❓ How to Sort by Reviews, Rating, or Category?

We sort the listings using a really good sorting order, which is as follows:

  • Reviews [Businesses with more reviews come first]
  • Website [Businesses more open to technology come first]
  • LinkedIn [Businesses that are easier to contact come first]
  • Is Spending On Ads [Businesses already investing in ads are more likely to invest in your product, so they appear first.]

However, you also have the freedom to sort them according to your preferences as follows:

  • To sort by reviews:

    Gmaps.places(queries, sort=[Gmaps.SORT_BY_REVIEWS_DESCENDING])
  • To sort by rating:

    Gmaps.places(queries, sort=[Gmaps.SORT_BY_RATING_DESCENDING])
  • To sort first by reviews and then by those without a website:

    Gmaps.places(queries, sort=[Gmaps.SORT_BY_REVIEWS_DESCENDING, Gmaps.SORT_BY_NOT_HAS_WEBSITE])
  • To sort by name (alphabetically):

    Gmaps.places(queries, sort=[Gmaps.SORT_BY_NAME_ASCENDING])
  • To sort by a different field, such as category, in ascending order:

    Gmaps.places(queries, sort=[[Gmaps.Fields.CATEGORIES, Gmaps.SORT_ASCENDING]])
  • Or, to sort in descending order:

    Gmaps.places(queries, sort=[[Gmaps.Fields.CATEGORIES, Gmaps.SORT_DESCENDING]])

❓ Advanced Questions

Having read this page, you have all the knowledge needed to effectively utilize the tool.

You may choose to explore the following questions based on your interests:

For Knowledge

  1. Do I Need Proxies?
  2. Does Running a Scraper on a Bigger Machine Scrape Data Faster?

For Technical Usage

  1. I Don't Have Python, or I'm Facing Errors When Setting Up the Scraper on My PC. How to Solve It?
  2. How to Scrape Reviews?
  3. What Are Popular Snippets for Data Scientists?
  4. How to Change the Language of Output?
  5. I Have Google Map Places Links, How to Scrape Links?
  6. How to Scrape at Particular Coordinates and Zoom Level?
  7. When Setting the Lang Attribute to Hindi/Japanese/Chinese, the Characters Are in English Instead of the Specified Language. How to Transform Characters to the Specified Language?

About

Google Maps Reviews Scraper 🕷️

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.8%
  • Other 1.2%