-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathchromeHistory.py
48 lines (40 loc) · 1.72 KB
/
chromeHistory.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import os
import pandas as pd
from functions import *
# Vars:
__name__ = "CHE"
__author__ = "TooSlepy"
__PyVer__ = "3.6"
data = []
fp = os.getenv("appdata")+"\..\Local\Google\Chrome\\User data\Default\\" # Sets file path
dbFile = fp+"\History" # Database file
for array in sql3(dbFile, 'downloads'):
for row in array:
row = str(row)
title = sqlWhen('title', 'urls', 'id', row)
url = sqlWhen('url', 'urls', 'id', row)
visitCount = sqlWhen('visit_count', 'urls', 'id', row)
lastVisitTime = sqlWhen('last_visit_time', 'urls', 'id', row)
if lastVisitTime == "1610612736" or lastVisitTime == "-1610612736":
lastVisitTime = 'Honestly I have no idea this data entry has an underflow or overflow'
else:
lastVisitTime = str(date_from_webkit(lastVisitTime, 10))
typedCount = str(sqlWhen('typed_count', 'urls', 'id', row))
isHidden = sqlWhen('hidden', 'urls', 'id', row)
if isHidden == '0':
isHidden = False
else:
isHidden = True
data.append(
{'Title': title, 'Url': url, 'Amount of times visited': visitCount, 'Time last visited': lastVisitTime,
'Amount of times typed': typedCount, 'Amount of time spent on site': visitDuration})
print({'Title': title, 'Url': url, 'Amount of times visited': visitCount, 'Time last visited': lastVisitTime,
'Amount of times typed': typedCount, 'Amount of time spent on site': visitDuration})
full = str(data)
full = full.replace("'", '"')
full = full.replace("😋","'")
dl = open("exported\chromeHistory" + ".json", "w")
dl.write(str(full))
print(full)
# Closing the connection to the database file
sql3(dbFile,'downloads').close()