Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Access Firefox/Chrome search keywords
## 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
You can’t perform that action at this time.