This creates a command for you to run in the terminal (or similar) zsh shell terminal app. I believe this should work in bash terminals as well. Once you're done setting it up you simply type
Jeff@MBP ~ % safariHist 8
Thu Jun 18 16:50:59 EDT 2020 | YouTube
Thu Jun 18 16:50:51 EDT 2020 | Browse All of Google's Products & Services - Google
Thu Jun 18 16:50:49 EDT 2020 | Browse All of Google's Products & Services - Google
Thu Jun 18 16:50:47 EDT 2020 | Google - About Google, Our Culture & Company News