Thanks for the suggestion. Unfortunately, I believe that the “takeout” downloads one’s entire history, and then it puts in on google drive. I need only a segment and a direct download to my server would avoid the extra step of getting the file from google drive.

There’s some discussion about alternatives in these places:

https://productforums.google.com/forum/#!topic/maps/e4t5ijeVdPs
https://stackoverflow.com/questions/32332904/current-url-to-download-kml-data-from-google-location-history