xd1936
xd1936

Reputation: 1180

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

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

Upvotes: 27

Views: 17694

Answers (3)

Jossef Harush Kadouri
Jossef Harush Kadouri

Reputation: 34217

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

Upvotes: 6

xd1936
xd1936

Reputation: 1180

Unofficial Python library for this that's based on session cookies. Who knows how long that'll last:

https://github.com/costastf/locationsharinglib

Upvotes: 7

xomena
xomena

Reputation: 32178

Shared locations are not available via Google Maps API at the moment. There is a feature request in Google issue tracker for this:

https://issuetracker.google.com/issues/62938530

You can add star to this feature request to express your interest and subscribe to future notifications from Google.

Upvotes: 14

Related Questions