Export History from Pale Moon

Post your tutorials for using applications or performing related tasks here.
Note: Not for "how do I...?" Questions!
Forum rules
Tutorials and Howtos should only relate to developed software, and not to third party applications. e.g.: Don't post a generic Howto for configuring a firewall.
If you have a question how to do something, you should use one of the support boards, not this board. It is meant for people to document and post instructions.
User avatar
Isengrim
Board Warrior
Board Warrior
Posts: 1325
Joined: 2015-09-08, 22:54
Location: 127.0.0.1
Contact:

Export History from Pale Moon

Unread post by Isengrim » 2020-10-12, 22:54

Someone asked about this on IRC, so I thought I'd do a quick write up on how to export your browsing history from Pale Moon to a CSV file. This is a fairly manual and technical process, and if you mis-click something or don't pay attention to what you're doing, you could corrupt your places database, including but not limited to your history, bookmarks, favicons, and form data. Here there be dragons. YOU HAVE BEEN WARNED! I highly recommend closing the browser and backing up your profile before attempting this operation just to be safe.

Pale Moon stores your history data in a SQLite database within your profile. Unfortunately, unlike with bookmarks, browsers do not follow a standard convention for exporting your history data, and Pale Moon does not offer a built-in feature to do so. This leaves us with two options: Write an extension*, or use an external database editing tool. For this tutorial, I will be using a tool called SQLite Browser, which is very easy to use and has downloads available for most major operating systems.

1) Download and install SQLite Browser.
2) Run SQLite Browser, then click and hold "Open Database" until a dropdown menu appears. From there, select "Open Database Read Only".
3) Navigate to your profile directory (or whichever profile you want to export from) and select the places.sqlite file within.
4) If the file opens successfully, you should see a list of tables and indices, most of which should start with "moz".

sqlite1.png
Fig. 1 - places.sqlite open in SQLite Browser

5) Click the "Execute SQL" tab. We will be running a custom query to pull our most relevant history data.

sqlite2.png
Fig. 2 - Query editor view

6) In the empty query editor, paste the following query:

Code: Select all

SELECT
	p.url as url,
	p.title as title,
	p.visit_count as visit_count,
	datetime(p.last_visit_date/1000000, 'unixepoch', 'localtime') as last_visit_date
FROM
	moz_places AS p
WHERE
	p.visit_count > 0
ORDER BY
	last_visit_date DESC
7) Click "Execute all" (the play button at the top). Depending on the amount of history you have in your browser, this could take some time.
8) When the query finishes, click "Save the results view" button at the top and select "Export as CVS".
9) Click "Save".
10) Choose a file to save to and click "Save".

Your now have your browsing history dumped to CSV! From here, you can open it in a spreadsheet program and view, sort, or filter the data as you wish. You can also run grep or another command line tool against the file. If you're feeling adventurous, you could even write a script to import this data to another browser, but that is left as an exercise to the reader.

I hope this tutorial is helpful. I'll update this post with any relevant feedback, in case you guys have any questions, comments, concerns, or compliments. :)



* An extension for viewing and exporting your history data to a file would be a very Good First Extension for anyone willing to try. ;)
a.k.a. Ascrod
Linux Mint 19.3 Cinnamon (64-bit), Debian Bullseye (64-bit), Windows 7 (64-bit)
"As long as there is someone who will appreciate the work involved in the creation, the effort is time well spent." ~ Tetsuzou Kamadani, Cave Story

Locked