Do you want KM to track this information as the user uses the browsers, or do you want KM to examine each browser's history records?
Do you want a separate solution for each browser, or do you want a single solution that works for all browsers at the same time?
Getting the URL history from a browser would look like this: (all those browsers store their data in a database)
sqlite3 ~/Library/Safari/History.db "SELECT * FROM history_items;"
Try that on your Mac and see if you can take it from there.
This command will extract the URL and the time of every item in the Safari history log. This is getting very close to your answer of "is it possible to populate this data in a fresh txt file?"
sqlite3 ~/Library/Safari/History.db "SELECT history_items.url, datetime(history_visits.visit_time + 978307200, 'unixepoch', 'localtime') as visit_time FROM history_items JOIN history_visits ON history_items.id = history_visits.history_item;"
Good job. I was imagining that he wanted the ability to control the dat filtering, so I included everything.
I must confess, while most of my answers are written WITHOUT any assistance from ChatGPT, this answer did come with assistance. I've barely used SQL since I got trained on it.
You might want to consider the history hound app. www.stclairsoft.com/HistoryHound/
The index is not just the URL but keywords on that indexed page i.e. it indexes your history. Cost about 15.00gbp.
The weakness in all this is that the top level page gets written to the history file, but subsequent "embedded" pages do not; but it really helps when you are thinking what was that web page I visited last week...??
I also highly recommend Default Folder X which I would not be without.
I am just happy getting a solution. But i would like to have separate lists for each browser. Either in the same file appended after one another or separate file for each browser.
I have no idea how to do that. I am not a programmer. I don't even know where to put this code (what kind of keyboard maestro action)
humorous and as always you came forward to help. I appreciate that. BTW where do we put this code?
the funny thing is, looking at that code i have no clue how to control the filtering. Anyways, I happy with anything either 'since 12 AM today' or 'since 5 AM today'. I don't need to have any type of control over the filters.
good to have this at the back of my mind in case i have to develop my use case further or the use case have a strong place in my regular streamlined workflow. For now, i am not looking for paid software solutions for my use case.
Oh. Sorry. My fault. I thought you would know what an "Execute Shell Script action" was. Here's the full action. My action creates a CSV file, which is what you said you wanted. (CSV files don't actually have to use commas to separate fields. This action separates fields with vertical bars.)
Try this action, then try importing the file ~/myhistory.csv into your app. Which app are you using to read CSV files? Different apps may have different steps for importing CSV files which use vertical bars as separators. I don't think you indicated which app you were planning to use.
My app loads the whole history file, so you might want to clear your history to test this. Or you can try Nige's modified sciprt, but that script didn't work for me.
Similar -- except I've never been trained, just picked bits up here and there.
Actually, it doesn't -- it's a text file with fields separated by sqlite's default field delimiters (usually |). If you want to generate CSV, include the option in your command:
sqlite3 -csv ~/Library/Safari/History.db ...
Try it in the Terminal app first, it'll be easier to see the output (and any error messages) to check it does what you want.
The wikipedia page on CSV files says that CSV files don't need to use a comma to separate values. They can use other characters. I left it as a vertical bar because URLs typically have commas. If it walks like a duck and talks like a duck, it's a duck.