Internet History Script For Google Chrome

后端 未结 5 1315
暖寄归人
暖寄归人 2021-02-06 15:48

I\'m not looking for a \"best\" or most efficient script to do this. But I was wondering if there exists a script to pull Internet History for a day\'s time from, say, Google Ch

5条回答
  •  误落风尘
    2021-02-06 16:31

    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)
    

提交回复
热议问题