Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to get the browser history programmatically. Here's what I've done (in python, using sqlite3):

connection = sqlite3.connect('/home/quantka/.mozilla/firefox/35lwme56.profile0/places.sqlite')
cursor.execute("SELECT url FROM moz_places")
history = cursor.fetchall()

This always returns the same 11 results that only include default mozilla sites like "", even after I use the browser and go to other websites. I have verified that I am querying the correct profile (I think I checked all the profiles and all of them have the same 11 default sites).

Just for context, I am using the browser to go to websites through mozrepl, I don't think that should cause this problem, but maybe it is?

I have seen this same approach work on a different computer where I have only one profile and browsed using firefox's GUI.


share|improve this question
kinda obvious, but I'd try using the browser to manually make a few history entries, then rerun your script. It's entirely possible mozrepl isn't putting its history in the same (or any) place. –  MattDMo Aug 2 '13 at 18:44
I'd have a hard time doing that since I'm sshing into this machine and I can't seem to get x forwarding to work. I have tried starting firefox from the command line (no mozrepl) on the machine with a url, and that url does not show up in the history. –  quantka Aug 2 '13 at 18:50
is the size/modification time of places.sqlite changing as you use mozrepl? Is it possible the history is being stored in a different table besides moz_places? I'm not sure, kinda grasping at straws here... –  MattDMo Aug 2 '13 at 19:00
Have you thought of using Selenium with Python and seeing if that populates the history properly? –  MattDMo Aug 2 '13 at 19:02
It looks like places.sqlite is not changing size. If I'm going to do something possibly involved like installing stuff, I may as well try harder to get x forwarding to work... –  quantka Aug 2 '13 at 19:13

1 Answer 1

Can you try querying directly from sqlite? While in the correct user profile directory you can use the following command to pipe the history to a text file or omit the dashes and quotes to have it print to terminal.

sqlite3 places.sqlite "SELECT strftime('%d.%m.%Y %H:%M:%S', visit_date/1000000, 'unixepoch', 'localtime'),url FROM moz_places, moz_historyvisits WHERE = moz_historyvisits.place_id ORDER BY visit_date;" | tee /user/home/FirefoxHistory.txt


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.