Skip to content

Command-line tool to export some items from the Firefox places.sqlite database.

License

Notifications You must be signed in to change notification settings

wmelvin/firefox-places

Repository files navigation

firefox-places

Firefox stores data about browsing history and bookmarks in a Places database. That database is in a file named places.sqlite in the profile1 folder. The export_firefox_places.py tool queries that SQLite2 database and produces a set of output files. It uses the sqlite33 module in the Python Standard Library to do so.

This command-line tool is not meant to be a general-purpose utility. It serves a specific purpose for the author. Nonetheless, it may also serve as an example for others who want to extract a different set of data from their Places database.

For exploring the Places database, and trying different queries, check out Datasette or the DB Browser for SQLite.

Input

It is probably safer to make a copy of the places.sqlite file, when Firefox is not running, and work with that when running this tool.

Output

The following files are produced:

prefix-bookmarks.csv - A listing of parent_path, title, and url in text/csv format.

prefix-bookmarks.html - A html file with links to each bookmark url.

prefix-frecency.csv - A listing of url, title, and frecency4 in text/csv format.

prefix-github-links.html - A html file listing bookmarks where the url points to a GitHub page. This is optional (-g switch).

prefix-history.csv - A listing of url, title, host, visit_count, frecency, and visit_date in text/csv format.

prefix-recent-links.html - A html file listing the "Top 100 Recent/Frequent Links."

Command-Line Usage

usage: export_firefox_data.py [-h] [-p OUTPUT_PREFIX] [-g] places_file

Extracts information from a Firefox places.sqlite file.

positional arguments:
  places_file           Path to the places.sqlite file.

optional arguments:
  -h, --help            show this help message and exit
  -p OUTPUT_PREFIX, --output-prefix OUTPUT_PREFIX
                        Name of prefix for output files. Default is 'places'.
  -g, --do-github       Include an output file listing bookmarks for github
                        URLs.

Additional

There is also a tool named check_html_output.py in this repository. It was used to verify that the generated HTML files are parsable.

Reference

Footnotes

  1. Firefox - Profiles

  2. SQLite, SQLite As An Application File Format

  3. Python - sqlite3 DB-API 2.0 interface for SQLite databases

  4. Firefox - Frecency

About

Command-line tool to export some items from the Firefox places.sqlite database.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages