Is there a way to get Google Maps Shared Locations via API?

Viewed 12161

Google Maps has a wonderful Contact Location Sharing feature. Does anyone know if this data is available programmatically? It would would be helpful to have access to mine and my wife's location for things like Home Automation or scripting

3 Answers

There is no official API, but someone created a cool Python package locationsharinglib to extract this information from the Google Maps internal browser app.

Install

pip install locationsharinglib

Usage:

from locationsharinglib import Service

cookies_file = 'cookies.txt'
google_email = '<your google username>@gmail.com'

service = Service(cookies_file=cookies_file, authenticating_account=google_email)

for person in service.get_all_people():
    print(person)
  • cookies.txt file

    You need to sign out, and manually sign into your Google account. Then browse to google.com/maps and extract from your "google.com" cookies and save it as cookies.txt

Related