From 0c1b1b523cfc98833ec31297aa901360ae98318d Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Mon, 3 Feb 2020 20:18:18 -0500 Subject: [PATCH] Add safari history support to archivebox-export-browser-history --- bin/archivebox-export-browser-history | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bin/archivebox-export-browser-history b/bin/archivebox-export-browser-history index dbea951e..4b12a49c 100755 --- a/bin/archivebox-export-browser-history +++ b/bin/archivebox-export-browser-history @@ -35,3 +35,19 @@ if [[ "$1" == "--firefox" ]]; then echo "Firefox history exported to:" echo " output/sources/firefox_history.json" fi + +if [[ "$1" == "--safari" ]]; then + # Safari + if [[ -e "$2" ]]; then + cp "$2" "$REPO_DIR/output/sources/safari_history.db.tmp" + else + default="~/Library/Safari/History.db" + echo "Defaulting to history db: $default" + echo "Optionally specify the path to a different sqlite history database as the 2nd argument." + cp "$default" "$REPO_DIR/output/sources/safari_history.db.tmp" + fi + sqlite3 "$REPO_DIR/output/sources/safari_history.db.tmp" "select url from history_items" > "$REPO_DIR/output/sources/safari_history.json" + rm "$REPO_DIR"/output/sources/safari_history.db.* + echo "Safari history exported to:" + echo " output/sources/safari_history.json" +fi