Last active
May 21, 2020 15:32
-
-
Save ra312/d28000cd18f704a77f0001d20c9c6e7c to your computer and use it in GitHub Desktop.
raise my browsing self-awareness
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sqlite3 | |
import operator | |
from collections import OrderedDict | |
#path to user's history database (Chrome) | |
data_path = os.path.expanduser('~')+"/Library/Application Support/Google/Chrome/Default" | |
files = os.listdir(data_path) | |
history_db = os.path.join(data_path, 'history') | |
#querying the db | |
c = sqlite3.connect(history_db) | |
cursor = c.cursor() | |
select_statement = "SELECT urls.url FROM urls, visits WHERE urls.id = visits.url;" | |
cursor.execute(select_statement) | |
results = cursor.fetchall() #tuple | |
urls = [result[0] for result in results] | |
print('\n'.join(urls)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment