Extfiltrating Google Location History from Timeline
Asked Answered
B

2

12

Note, due to changes to Google's "Timeline" this previous answer no longer works.


Google offers a "Timeline" service which allows users to access their phone's location history.

I want to extract my phone's current location.

If I select "today" in Timeline, I can "Export this day to KML"

enter image description here

This contains the data I need, but I don't know how to get these data programatically. I don't want to have to log in to the website every time I need this information.

The URL it provides is -

https://doc-0uom0-1q5a8-s-googleusercontent.commondatastorage.googleapis.com/gs/[hash1]/[hash2]/1441116000000/takeout-eu/[user id]/[stupidly long hash]&nonce=[hash3]&user=[user id]&hash=[hash4]

Apart from the Unix timestamp (1441116000000) I don't know how to calculate the parameters for that URL.

The Google Maps API documentation doesn't list anything.

I'd like to be able to wget a URL to collect my data. Does anyone know how this can be done?

Browband answered 1/9, 2015 at 15:9 Comment(0)
E
7

This will give the latest points, I believe:

 https://www.google.com/maps/timeline/kml
Eximious answered 2/9, 2015 at 1:23 Comment(3)
I'm not sure if that's correct. From that URL, I get <Document><name> Location history from 2015-09-01 to 2015-09-01 </name> but today is 2015-09-02Browband
I'm not 100% sure either. My data is identified as being for a single date (in both the name and the description tags) but the points are from two days. The most recent point has a time stamp of 2015-09-01 @ 17:54 Pacific. I downloaded the file at 18:19 Pacific Time. I had been home for a bit.Eximious
Shoot. I just checked again. My timeline on the web has a point at 3:24 Pacific and the last point I can download, using the url I suggested is for around 20 Pacific, yesterday. (I haven't moved very much -- just inside the house.)Eximious
B
4

According to this question - Current URL To Download KML Data From Google Location History? - the URL format is:

Eg https://www.google.com/maps/timeline/kml?authuser=0&pb=!1m8!1m3!1i2015!2i7!3i1!2m3!1i2015!2i7!3i8 gives 7 days.

Highlighting the parts of the date: pb=!1m8!1m3!1i2015!2i7!3i8!2m3!1i2015!2i7!3i8

Note the month is zero based, so one off normal, 0=Jan, 11=Dec

So, in order to get today's date (2015-09-01) the URL needs to be

https://www.google.com/maps/timeline/kml?authuser=0&pb=!1m8!1m3!1i2015!2i8!3i1!2m3!1i2015!2i8!3i1

i.e.

pb=!1m8!1m3!1iYYYY!2iMM!3iDD!2m3!1iYYYY!2iMM!3iDD

Where MM is a Javascript style zero-based month.

Within the KML, the times are West Coast USA - e.g. <when>2015-09-01T12:15:37.836-07:00</when>

So your requests may need to take that into account.

Browband answered 1/9, 2015 at 20:9 Comment(1)
Hi, I tried with the above link , but only able to get data for 1 day google.com/maps/timeline/… whereas I am trying to fetch data from 2020-02-04 to 2020-02-27 Kindly help!Gobo

© 2022 - 2024 — McMap. All rights reserved.