Subject: How to merge Firefox History into Chromium History Plus
Author: The Old Coder aka Robert Kiraly. License: Creative Commons BY-NC-SA 4.0 International. Revision: 260214.
This post is intended for Linux CLI users who happen to use both Firefox and Chromium or spoons of the browsers. Windows users who are familiar with WSL CLI may find this post useful as well.
I use both LibreWolf [a Firefox spoon] and Ungoogled Chromium [which I'll refer to as UChromium]. In UChromium, I use the UChromium History+ extension to solve the Chromium 90-day history limit problem.
Note: History+ offers other nice features as well and is recommended. The link for the extension is presently:
https://chromewebstore.google.com/detail/history-plus/kloodnjmhgicecceindgbfpjencnhajh
The History+ extension isn't supported for Firefox [or LibreWolf]. I'd like to be able to merge LibreWolf history periodically into History+ on the UChromium side regardless. History+ tricks related to the UChromium built-in "Import History" feature don't appear to work correctly. So, here's what I'm doing instead.
This procedure should work in any recent and reasonably standard Linux distro.
Step 1. Install the CLI tool "mlr". This step is distro specific. Under Debian, for example, one would do this: sudo apt-get install miller ["miller" is the Debian package that provides "mlr"].
Step 2. In Firefox or LibreWolf, install the History Export extension by SkyWeb. The link for that extension is presently:
https://addons.mozilla.org/en-US/firefox/addon/sky-history-export/
Step 3. Use the History Export extension on the Firefox or LibreWolf side to export history to a JSON file named, for example, "firefox-history.json".
Step 4. At the Linux CLI level, execute the following command in the directory where the JSON file is stored:
mlr --headerless-tsv-output --j2t cat \
then filter '!($url =~ "^file:" || $url == "")' \
then put '$title = is_null($title) ? "" : $title' \
then cut -x -f id \
then put '$lastVisitTime="U".$lastVisitTime.".000"' \
then reorder -e -f title \
then put '$z1 = 0' \
then put '$z2 = 0' \
then sort -f url \
firefox-history.json > firefox-history.tsvStep 5. In the History+ settings on the UChromium side, which may be accessed via the gear icon shown in the attached screenshot, import the TSV file created by the preceding step.
Note: History+ is designed to avoid duplicate records. So, it should be safe to import a particular history file more than once or multiple history files that have overlapping records.
If you have a LinkedIn account, a LinkedIn version of this post may be viewed at:
https://www.linkedin.com/pulse/how-merge-firefox-history-chromium-plus-robert-kiraly-3jejc/
#linux #cli #firefox #chrome #chromium