Extracts Shared locations from Google Maps 🌍🔎👨👩👧👦 to JSON for Node.js. There is not an official api for Shared locations by Google, so it requires _full username and password for Google_ account. gomshal
Install
💾 npm: npm install gomshal --save
Npm ignore scripts flag
❗️ Enabling npm scripts is necessary to install playwright
. Using npm scripts, browsers are installed which can then be controlled automatically.
If you have set npm config get ignore-scripts
to true, you will not be able to use npm run commands even you specify --ignore-scripts=false
. This is because npm-run-all is used when running commands and this tool not forward npm ignore-scripts flag. You can disable ignore scripts with npm config set ignore-scripts false
. If you want to only install after repository clone, you can call ignore script only temporary for that install with npm install --ignore-scripts=false
.
Usage
🔧 Typescript minimal usage sample (if credentials are already set)
; ;gomshal.initialize;gomshal.onLocationsconsole.log;
🔧 Typescript full example of usage with custom configuration and callback on new shared locations data detected
; async startGomshal
🔧 Javascript with CommonJS modules
const Gomshal = ; { gomshal = ; state = await gomshal; console; console; gomshal;} ;
Demo
💻 There is an beautifull 🌈 Electron demo inside this monorepo. You can run it using this steps:
- clone this repository
git clone https://github.com/atiris/gomshal.git
, - open it
cd gomshal
and runnpm install
(ignore-scripts npm config must be set to false) - start
npm run demo
Development
💼 Clone this repository git clone https://github.com/atiris/gomshal.git
, cd gomshal
and run npm install
.
How does this library work
❓ Since 2020 Google require javascript to log in. So we need full browser support for using Google Maps (or get cookies in another way). For that reason I tried to use a puppeteer. However, this library has trouble enabling login because Google can effectively identify browser control and declare such a browser unsuitable for login. Now I use playwright instead. This project has a similar focus, and so far allows for automated login without detection from Google.
❗️ Dependency instalation: npm i playwright --save
has tens of megabytes and requires a full browser to run.
Windows development
It may be necessary to run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
in powershell console (as Administrator).
Notes
Publishing to npm
- Build typescript library:
tsc -p tsconfig.lib.json
- Test before publish
- create package:
npm pack
- move created package to npmtest directory:
mv gomshal-1.0.0.tgz npmtest\
- create package json in this directory and set some defaults
- try install npm package from file:
npm i gomshal-1.0.0.tgz
- create package:
- Login to npm:
npm login
- Initial library publishing
npm publish
- Fix
- bugfix or patch:
npm version patch
- features:
npm version minor
- breaking changes:
npm version major
- bugfix or patch:
Background
📝 I was inspired by the node-google-shared-locations repository in which I am a contributor. I could no longer simply modify this library without significantly affecting the core library architecture, so I created a new one from the very beginning. Compared to the previous library, this library contains significant expansions, but it is also larger and more resource-intensive.
Created in Slovakia 🇸🇰