Coder Social home page Coder Social logo

beubeucode / node-google-reviews-web-scraper Goto Github PK

View Code? Open in Web Editor NEW
23.0 2.0 11.0 70 KB

Home Page: https://www.npmjs.com/package/google-reviews-web-scraper

License: MIT License

JavaScript 100.00%
nodejs express puppeteer google google-maps reviews json web-scraping web-scraping-nodejs rest-api

node-google-reviews-web-scraper's Introduction

{DEPRECATED} - This library is no longer maintained, and apparently doesn't work anymore. Will rework it some day but for now it's dead.

node-google-reviews-web-scraper

Get the reviews from any google maps business 🗺

Contributions are highly appreciated !


npm install google-reviews-web-scraper

setup :

npm install

npm run start (launches program with nodemon)

New in 1.0.2 !

  • Set the output method of the getReviews method with an optional second argument : "json" or "object". The default is "json".

Description

This project aims to scrape data from the google maps business page in order to get the reviews (it's not in the api, why google ?)

Technologies used

  • Puppeteer
  • Express
  • NodeJS (duh)

Usage

There is a webserver in there, you can run it with npm run serve, and connect to localhost:3000 to get a json response with the url in the script. However, it is WIP so the point is just to return the data.

You can also run npm run start, which will show you the eiffel tower reviews (in french, cocorico !).

Re-use the code

There is only one interesting function inside the getReviws.js file, and it's the getReviews(url) method.

const getReviews = async (url) => {
    /**
     * Steps :
     * Open headless chrome with puppeteer
     * load the link
     * evaluate js expressions in the headless chrome instance 
     * return a slue of the interesting data.
     */
};

as it is exported, you can take this file and import the method by doing something like this :

const getReviews = require('./getReviews');

Import it with NPM

If you installed it with npm, you can do the following

const getReviews = require('google-reviews-web-scraper');

and then, calling the mod with the following args :

getReviews(url);

where url is a string. A google maps business url looks like this :

https://www.google.com/maps/place/Tour+Eiffel/@48.8583736,2.292298,17z/data=!4m5!3m4!1s0x47e66e2964e34e2d:0x8ddca9ee380ef7e0!8m2!3d48.8583701!4d2.2944813

The json object returned by the api looks like this :

{
  "reviewAuthorNames": [
    "Alexandre MASSON",
    "Caroline Nédélec",
    "Romain VILCOQ"
  ],
  "dates": ["il y a 5 jours", "il y a 2 semaines", "il y a 2 semaines"],
  "ratings":[5, 5, 5],
  "reviewsContent": [
    "Magnifique et incontournable monument de la capitale française. A absolument faire lors de votre visite parisienne ! Haute de 321 mètres, cette tour de fer surplombe la région parisienne. Véritable prouesse architecturale et scientifique, …",
    "Un lieu toujours magnifique. Attention ne vous faites pas photographier de force par tous ces photographes qui traînent dans la tour et qui veulent vous vendre des photos à prix d'or. Évidemment les prix ne sont pas affichés et le tarif est …",
    "La dame de fer est l'emblème de notre capitale, le monument à visiter en priorité. \nLa vue depuis le sommet est incontournable !\nL'ascension par les escaliers est une belle expérience et permet de profiter au mieux de la structure, cependant elle est réservée aux plus sportifs. La descente est possible également 😉"
  ]
}

node-google-reviews-web-scraper's People

Contributors

beubeucode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

node-google-reviews-web-scraper's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.