Last active
February 5, 2023 01:22
-
-
Save mahmoudimus/53f526b37280c699515fb0d4a153b209 to your computer and use it in GitHub Desktop.
Exports the history from Google Chrome's syncedTabs in chrome://history/syncedTabs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tablistcontainer = (document.getElementById("history-app") | |
.shadowRoot.getElementById("synced-devices") | |
.shadowRoot.getElementById("synced-device-list")); | |
/* for sessionbuddy import */ | |
var output = {tabs: []}; | |
/* run through synced device cards *only* */ | |
[].forEach.call(tablistcontainer.children, curNode => { | |
if (curNode.nodeName !== "HISTORY-SYNCED-DEVICE-CARD") { | |
return; | |
} | |
var historyitems = curNode.shadowRoot.getElementById("history-item-container"); | |
var anchors = historyitems.querySelectorAll("div > a.website-link"); | |
anchors.forEach((item) => output.tabs.push({ | |
nx_title: item.getAttribute("title"), | |
url: item.getAttribute("href") | |
})); | |
}) | |
copy(JSON.stringify(output)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
1. Go to chrome://history/syncedTabs | |
2. Open up the console | |
3. Copy & paste the script below into the console | |
4. Profit | |
*/ | |
const history = document.querySelector("#history-app").shadowRoot; | |
const main = (history.querySelector("#main-container > iron-pages#content > history-synced-device-manager#synced-devices") | |
.root.querySelector("div#synced-device-list > history-synced-device-card")); | |
var anchors = root.querySelectorAll("div > a.website-title"); | |
// anchors.forEach((item) => console.log(item.getAttribute("href"))); | |
/* for sessionbuddy import */ | |
var output = {tabs: []}; | |
anchors.forEach((item) => output.tabs.push({Title: item.getAttribute("title"), URL: item.getAttribute("href")})); | |
copy(JSON.stringify(output)); // double JSON.stringify() if you need to escape into CSV |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment