I wanted to find something I'd googled for recently. That should be easy, right? Just go to the browser's history window.
Well, actually not so much. You can see them in Firefox's history window, but they're interspersed with all the other places you've surfed so it's hard to skim the list quickly.
I decided to take a little time and figure out how to extract the search terms. I was pretty sure that they were in places.sqlite3 inside the firefox profile. And they were. After copying I eventually extracted the search terms with the query:
SELECT url, last_visit_date FROM moz_places WHERE url like '%https://www.google.com/search?q=%';
That found the URLs — but they're long and obfuscated. A typical Google query URL looks like:
Turning that into something readable requires two things: stripping off everything that's not part of the query string, then mapping the query string into readable characters, e.g. replacing + with a space, and replacing %22 with a double-quote character.
Pretty straightforward with Python: searchhistory.py on GitHub
I'd already done that before I realized there was an easier way, because places.sqlite also saves page titles:
select title from moz_places where URL LIKE '%google.com/search?q%';which gives values like
bitlbee rejoin control channel - Google Searchand you can just remove everything from the ' - ' onward.
[ 16:54 Jan 10, 2023 More tech/web | permalink to this entry | ]