Skip to content

Instantly share code, notes, and snippets.

@chsivateja
Forked from stratosgear/list.py
Last active December 1, 2015 00:36
Show Gist options
  • Save chsivateja/b62c6bcfc15fc0d70c8e to your computer and use it in GitHub Desktop.
Save chsivateja/b62c6bcfc15fc0d70c8e to your computer and use it in GitHub Desktop.
Nicely display Google history
#!/usr/bin/python2
import sys
import json
from datetime import datetime
if len(sys.argv) < 2:
print "Give me the json file to display!"
sys.exit(-1)
with open(sys.argv[1], 'r') as jsonFile:
searches = json.load(jsonFile)
for search in searches['event']:
when = datetime.fromtimestamp(int(search['query']['id'][0]['timestamp_usec']) / 1000000)
print u'{:%Y-%m-%d %H:%M:%S}: {}'.format(when, search['query']['query_text'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment