'''
load your activity log, scroll to the very bottom,
save as html, then run this to export your data.
this works for me; it may or may not work for you.
no copyright 2017 robert luxemburg. public domain.
'''
import datetime
import json
import os
import re
def format_text(text):
for pair in [
('
?', '\n'),
('See More', ''),
('<[^<]+?>', ' '),
('( +)', ' ')
]:
text = re.sub(pair[0], pair[1], text)
return text.strip()
dirname = 'in'
filename = os.path.join(dirname, [
f for f in os.listdir(dirname) if f.endswith('.html')
][0])
username = filename[3:-5]
with open(filename) as f:
html = f.read()
separator = '