2

Exploring your Search History in Firefox (Shallow Thoughts)

 1 year ago
source link: https://shallowsky.com/blog/tech/web/firefox-search-history.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Exploring your Search History in Firefox

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:

https://www.google.com/search?q=python+parse+google+url+%22query+string%22&client=firefox-b-1-d&ei=NXp2Y_ybEuCC0PEPt5qqsAU&ved=0ahUKEwi8iv-R6bX7AhVgATQIHTeNClYQ4dUDCA8&uact=5&oq=python+parse+google+url+%22query+string%22&gs_lcp=Cgxnd3Mtd2l6LXNlcnAQAzIFCCEQoAEyBQghEKABMgUIIRCrAjoKCAAQRxDWBBCwAzoFCAAQogRKBAhBGABKBAhGGABQiQlY1Q1gkQ9oAXABeACAAYwBiAGKApIBAzAuMpgBAKABAcgBCMABAQ&sclient=gws-wiz-serp

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 Search

and you can just remove everything from the ' - ' onward.



Tags: web, firefox, google, sqlite
[ 16:54 Jan 10, 2023    More tech/web | permalink to this entry | ]


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK