Skip to content

Instantly share code, notes, and snippets.

@MyGodIsHe
Created November 5, 2018 11:36
Show Gist options
  • Save MyGodIsHe/14409c426b5a6bbde80da133a6002fc9 to your computer and use it in GitHub Desktop.
Save MyGodIsHe/14409c426b5a6bbde80da133a6002fc9 to your computer and use it in GitHub Desktop.
Chrome history export. Open chrome://history/, open dev console, put this code, press PageDown, then P for create result in div.
(function() {
var outDiv = document.createElement("div");
document.body.appendChild(outDiv);
var history_item = document.getElementById("history-app").shadowRoot.getElementById("history").shadowRoot.getElementById("infinite-list").getElementsByTagName("history-item");
var output = new Set();
document.body.onkeydown = function handle(e) {
if (e.keyCode == 34) {
for (item in history_item) {
var item = history_item[item].shadowRoot;
if (!item) continue;
var date = item.getElementById("date-accessed").innerHTML.trim();
var time = item.getElementById("time-accessed").innerHTML.trim();
var a = item.getElementById("title-and-domain").children[0]
var href = a.getAttribute("href").trim();
var title = a.getAttribute("title").trim();
var key = date+" "+time+"\n"+title+"\n"+href;
output.add(key);
}
}
if (e.keyCode == 80) {
outDiv.innerHTML = Array.from(output).join("\n\n");
}
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment