Skip to content

Instantly share code, notes, and snippets.

@evidanary
Created July 27, 2016 00:57
Show Gist options
  • Save evidanary/d02d89c632530878163f256fe993d5a4 to your computer and use it in GitHub Desktop.
Save evidanary/d02d89c632530878163f256fe993d5a4 to your computer and use it in GitHub Desktop.
Export search history from chrome
// THis is for getting the search history on chrome
//Navigate to chrome://history/
//Search for "google.com/search/?q=" in the search box
function writeChromeHistoryToFile(fileName) {
coln = document.getElementsByTagName("a")
data = [].slice.call(coln).map((x) => x.href)
if(typeof data === "object"){
data = JSON.stringify(data, undefined, 4)
}
var blob = new Blob([ data ], {type: 'text/json'})
var e = document.createEvent('MouseEvents');
var a = document.createElement('a');
a.download = fileName
a.href = window.URL.createObjectURL(blob)
a.dataset.downloadurl = ['text/json', a.download, a.href].join(':') e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null)
a.dispatchEvent(e)
}
//In teh chrome console run
writeChromeHistoryToFile('history.txt')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment