Last active
July 16, 2024 19:27
-
-
Save CypherpunkSamurai/c78be0b6dfdaa5f0353254d89bd73573 to your computer and use it in GitHub Desktop.
Google Saved Content to File
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
// allow saving google.com/saved folder to a file | |
var href_list = []; | |
var cols = document.querySelectorAll(".OmLvtc") | |
cols.forEach((col) => { | |
var items = col.querySelectorAll(".EHB20b") | |
items.forEach((item) => { | |
href_list.push( | |
item.querySelector("a").getAttribute("href").indexOf("/url?q=") !== -1 ? decodeURI(item.querySelector("a").getAttribute("href").replace("/url?q=", "")) : decodeURI(item.querySelector("a").getAttribute("href")) | |
) | |
console.log(href_list) | |
}) | |
}) | |
// create a text file and provide link to download | |
// append href_list to the text file in line by line | |
var a = document.createElement('a'); | |
var file = new Blob([href_list.join('\n')], {type: 'text/plain'}); | |
a.href = URL.createObjectURL(file); | |
a.download = 'links.txt'; | |
document.body.appendChild(a); | |
a.click(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment