Last active
August 29, 2015 14:15
-
-
Save MimiOnuoha/f50c8c71a2569b2e1b8d to your computer and use it in GitHub Desktop.
Access Firefox/Chrome search keywords
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
## Super simple Python code for querying a Chrome or Firefox database to access keywords and put them into a CSV. | |
## You'll need to make sure that your browser history file is already in the working directory, find them at below paths for OSX: | |
## Chrome: /Users/$USER/Library/Application Support/Google/Chrome/Default/Preferences | |
## Firefox: /Users/$USER/Library/Application Support/Firefox/Profiles/$PROFILE.default/places.sqlite | |
import dataset, csv | |
def grab_keywords(filename): | |
db = dataset.connect(filename) | |
result = db['keyword_search_terms'].all() | |
## For Firefox, uncomment the line below instead: | |
## result = db['moz_keywords.keyword'].all() | |
dataset.freeze(result, format = 'csv', filename = 'keywords.csv') | |
grab_keywords('sqlite:///History') #change to 'sqlite:///places.sqlite' for Firefox |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment