(function extractExternalLinks() {
    const currentHostname = window.location.hostname;
    const allLinks = document.querySelectorAll('a');
	
    const externalLinks = Array.from(allLinks)
        .filter(link => {
            return link.href && link.hostname && link.hostname !== currentHostname; // A external link won't point to itselves hostname.
        })
        .map(link => link.href); // Takes only the link
 
    const uniqueLinks = [...new Set(externalLinks)];
 
    console.log(`Found ${uniqueLinks.length} External Links:`);
    console.log(uniqueLinks.join('\n'));
    
    copy(uniqueLinks.join('\n'));
    console.log("Copied!");
})();