Where are the tabs in Safari saved (in iCloud or Finder)?

I want to recover several links of a website I had open as tabs for quite a few months now. But once it has been reloaded today, I've been redirected to a notice page of that website (it was temporarily shut down due to maintenance). Unfortunately, there's no "turn-back" button. So, recovering the previous links doesn't seem possible. This is why I'm hoping to find a way to recover it by finding out where the tab links have been saved.

I know that you can recover previously closed tabs in Safari directly under "history". So, the tabs should be saved somewhere. If it's saved in Finder, I should be able to easily recover it using Time Machine. If it's in iCloud, that should be possible, too, unless it automatically overwrites the links with no way to track it back.

Btw., recovering the links (it's about 20) by browsing through my history would be extremely time consuming as I usually open more than 30 (different) links of that website each day.


Solution 1:

Copy ~/Library/Safari/History.db and paste it at a convenient place like Desktop.

Download DB browser for sqlite https://github.com/sqlitebrowser/sqlitebrowser

Open the database file and find the items as you like.

Here are some tools to help you script the search process:

  • https://github.com/cedowens/macOS-browserhist-parser/tree/master/parse-browser-history/Sources/parse-browser-history
  • https://github.com/Roman2K/hist_safari2chrome