Internet History Script For Google Chrome

I am not looking for the “best” or most effective script for this. But I was wondering if a script exists to pull Daylight Internet History from, say, Google Chrome and register it in a txt file. I would prefer it to be in Python or MATLAB.

If you guys use a different method, using one of these languages, using locally stored browser history data from Google Chrome, for me too would be ears.

I would be very grateful if anyone could help with this!

+4
source share
5 answers

, . , , . Chrome . Win7, , win7: C:\Users\[username]\AppData\Local\Google\Chrome\User Data\Default\History

Python:

f = open('C:\Users\[username]\AppData\Local\Google\Chrome\User Data\Default\History', 'rb')
data = f.read()
f.close()
f = open('your_expected_file_path', 'w')
f.write(repr(data))
f.close()
+3

, m170897017 :

sqlite3, repr() .

sqlite SQL, . python sqlite3 stdlib .

SuperUser, SQL URL- : https://superuser.com/a/694283

+2

Having dodged sqlite3 / sqlite, I use the Google Chrome extension “Export History”, exporting everything to a CSV file and then loading this CSV file into cells in MATLAB.

Export History

My code turned out to be:

file_o = ['history.csv'];
fid = fopen(file_o, 'rt');
fmt = [repmat('%s', 1, 6) '%*[^\n]'];
C = textscan(fid,fmt,'Delimiter',',','CollectOutput',true);
C_unpacked = C{:}; 
C_urls = C_unpacked(1:4199, 5);
0
source

Here's another one:

import csv, sqlite3, os
from datetime import datetime, timedelta

connection = sqlite3.connect(os.getenv("APPDATA") + "\..\Local\Google\Chrome\User Data\Default\history")
connection.text_factory = str
cur = connection.cursor()
output_file = open('chrome_history.csv', 'wb')
csv_writer = csv.writer(output_file)
headers = ('URL', 'Title', 'Visit Count', 'Date (GMT)')
csv_writer.writerow(headers)
epoch = datetime(1601, 1, 1)
for row in (cur.execute('select url, title, visit_count, last_visit_time from urls')):
    row = list(row)
    url_time = epoch + timedelta(microseconds=row[3])
    row[3] = url_time
    csv_writer.writerow(row)
0
source

This is not what you are looking for, but with the help you can manipulate database tables to your liking.

import os
import sqlite3

def Find_path():
    User_profile = os.environ.get("USERPROFILE")
    History_path = User_profile + r"\\AppData\Local\Google\Chrome\User Data\Default\History" #Usually this is where the chrome history file is located, change it if you need to.
    return History_path

def Main():
    data_base = Find_path()            
    con = sqlite3.connect(data_base) #Connect to the database
    c = con.cursor()
    c.execute("SELECT name FROM sqlite_master WHERE type='table' ORDER BY name") #Change this to your prefered query
    print(c.fetchall())
if __name__ == '__main__':
    Main()
0
source

All Articles