How can I restore Firefox bookmark files from SQLite files?

jfmessier picture jfmessier · Aug 2, 2012 · Viewed 15.8k times · Source

I have two files that I managed to restore from a Firefox installation under Windows XP. The first one is urlclassifier3.sqlite and the second one is urlclassifier.pset.

I understand that those files contain the actual bookmarks for an installation of Firefox, under a user profile, given that the profile is .\Mozilla\Firefox\Profiles\akcum27.default. How can I restore the bookmarks from those files?

The big one is the .sqlite file, at around 56 kilobytes.

Answer

Peter Mortensen picture Peter Mortensen · Aug 27, 2015

A query that will actually work (on Windows as the question is about) is:

sqlite3 places.sqlite "select '<a href=''' || url || '''>' || moz_bookmarks.title || '</a><br/>' as ahref from moz_bookmarks left join moz_places on fk=moz_places.id where url<>'' and moz_bookmarks.title<>''" > t1.html

This presumes:

  • Using the Windows command-line (CMD)
  • The current directory is where places.sqlite is
  • SQLite 3 (executable sqlite3) is installed and is in the path (environment variable PATH)

Sample generated HTML:

<a href='http://www.wunderground.com/hurricane/'>Tropical weather</a><br/>
<a href='http://www.dmi.dk/vejr/maalinger/radar-nedboer/'>DMI, Radar</a><br/>
<a href='http://www.skyandtelescope.com/observing/objects/planets/3304091.html?page=1&c=y'>Transit Times of Jupiter's Great Red Spot - Planets - SkyandTelescope.com</a><br/>
<a href='https://www.quora.com/What-is-the-most-misspelt-word-in-the-English-language'>(951/25) What is the most misspelt word in the English language? - Quora</a><br/>
<a href='http://www.eevblog.com/2015/06/16/eevblog-754-altium-circuit-maker-first-impressions/'>EEVblog #754 - Altium Circuit Maker First Impressions | EEVblog - The Electronics Engineering Video Blog</a><br/>
<a href='https://www.arduino.cc/en/Main/ArduinoBoardUno'>Arduino - ArduinoBoardUno</a><br/>