If you are reading this, then you probably know that Google Maps has a great feature that allows you to pin locations using “stars”.

Google provides a way to export your “stars” as a JSON file, but there is no corresponding import function. Read the “Google Takeout” section, for instructions on how to simply export them.

If you have several hundred “stars”, read on, because importing them manually would probably take at least a whole day, and some stars would inevitably fall through the cracks.

Google Takeout

Go to Google takeout and select “maps” and export them, you should end up with a JSON file with your stars. In my case it was called “Saved Places.json” and its form was like this:

  "type" : "FeatureCollection",
  "features" : [ ... ]

Within the “features” array were all my stars in this format:

 "geometry" : {
  "coordinates" : [ 2.1850920, 41.3917170 ],
  "type" : "Point"
 "properties" : {
  "Google Maps URL" : "http://maps.google.com/?cid=15138001108724662971",
  "Location" : {
   "Address" : "Carrer de Buenaventura Muñoz, 24, 08018 Barcelona, Spain",
   "Business Name" : "Clínica Veterinària Ciutadella",
   "Geo Coordinates" : {
    "Latitude" : "41.3917170",
    "Longitude" : "2.1850920"
  "Published" : "2019-10-21T09:26:01Z",
  "Title" : "Clinica Veterinaria Ciutadella",
  "Updated" : "2019-10-21T09:26:01Z"
 "type" : "Feature"

This particular entry describes the location of a vet in Barcelona.

Once you have this JSON file, you can move onto the Puppeteer section of this process in the safe knowledge that your stars are backed up, and if all else fails, you can go through them manually.

Automated Import Overview

  1. Install required software.
  2. Set up browser log in.
  3. Test the script (because Google is prone to change its HTML and CSS structure).
  4. Run script.


  • Jared Potter - for how to work around logging in with the automated session.
  • Benji Bee - for the puppeteer script that this article’s one was adapted from.

Install Required Software

Many of these steps are system specific, what follows are instructions for Windows 10 with powershell.

Install node and npm (should be installed automatically with node), if you haven’t got them.

Go into or create the folder where this project is going to run from. It can be any folder, you will be making a new one there:

mkdir moveStars
cd moveStars
npm init --y
npm install puppeteer
npm install fs

Make sure its working by testing out some examples from the quickstart.

Setting up your Login

It is possible to manage logins with Puppeteer but its much simpler to just set up a debugging session and log in manually then have the puppeteer script connect itself to the logged-in browser. Especially since this script is designed to be run just once.

Within your project folder, in a path something like this:


You should find chrome.exe.

Once you have your path to that file, run the following command to open a remote debugging session:

C:\dev\moveStars\node_modules\puppeteer\.local-chromium\win64-818858\chrome-win\chrome.exe --remote-debugging-port=9222

Be sure to do it with the full path in one command, if you just call chrome.exe without specifying this particular executable (puppeteer’s copy) then it might end up using the system default.

This will open up a browser session. In the newly opened window go to URL

You should see some information. Copy the websocketDebuggerUrl value - this is the unique session value, which should look something like this:


Now you can connect your script to this very same browser session:

const wsChromeEndpointurl = 'ws://';
const browser = await puppeteer.connect({
    browserWSEndpoint: wsChromeEndpointurl,

Now, instead of managing logins and possible captchas in the script, you can just log in normally to the Google account you want to import your stars to, and then run the script. The script will connect itself to the same browser session and will not need to login.

The script

 * Based on:
 * https://gist.github.com/benjibee/37e0031a8aa7a25e9814a01bdb03217c
 * This script imports Google Stars from a geoJSON file to the logged in account.

const puppeteer = require('puppeteer');
const fs = require('fs');

const jsonFile = fs.readFileSync(__dirname + '\\Saved Places.json');
const jsonData = JSON.parse(jsonFile);

const wsChromeEndpointurl =

let scrape = async () => {

    const browser = await puppeteer.connect({
        browserWSEndpoint: wsChromeEndpointurl,

    const page = await browser.newPage();
    await page.goto('http://maps.google.com/', {waitUntil: 'networkidle2'});

    for (let index in jsonData.features) {

        let place = jsonData
                    .properties["Google Maps URL"];
        let name = jsonData
                    .properties["Location"]["Business Name"];

        await page.goto(place, {waitUntil: 'networkidle2'});
        await page.evaluate(() => {

            if (document.querySelectorAll(
                .length == 0) {

                }, 50);

                console.log('Added "' + name + '" to your starred places!');

            } else {
                    'Skipping "' + name + '" as it was already starred…'

        await page.waitFor(200)
    // uncomment if you want the browser to close after its done
    // browser.close(); 

scrape().then((value) => {
    console.log('All done!');
}).catch(e => console.log(e));

Its a good idea to test the script with a few stars before leaving it to its devices. In particular, you may need to fiddle and dig around with the CSS selectors in this section:

if (document.querySelectorAll(
).length == 0) {
    }, 50);

Which is the code that identifies the sequence of buttons that you need to press to “star” a location.