Last active
July 17, 2022 22:53
-
-
Save awitherow/3e593815f19f55e5be81c115b31ec1f9 to your computer and use it in GitHub Desktop.
Extract Social Media Profiles and Emails from Web Page
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
(function () { | |
const links = Array.prototype.slice.call(document.getElementsByTagName("a")).filter(item => | |
["twitter.com/", "facebook.com/", "youtube.com/", "pinterest.com/", "linkedin.com/in", ] | |
).map(item => item.href).filter(Boolean) | |
const emails = extractEmails(document.getElementsByTagName('html')[0].innerHTML) | |
const everything = [...links, ...emails] | |
const save = function (data, filename) { | |
if (!data) { | |
console.error("Console.save: No data"); | |
return; | |
} | |
if (!filename) filename = "console.json"; | |
if (typeof data === "object") { | |
data = JSON.stringify(data, undefined, 4); | |
} | |
var blob = new Blob([data], { type: "text/json" }), | |
a = document.createElement("a"); | |
var e = new MouseEvent("click", { | |
view: window, | |
bubbles: true, | |
cancelable: false, | |
}); | |
a.download = filename; | |
a.href = window.URL.createObjectURL(blob); | |
a.dataset.downloadurl = ["text/json", a.download, a.href].join(":"); | |
a.dispatchEvent(e); | |
}; | |
save(everything, document.title); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment