Skip to content

Instantly share code, notes, and snippets.

@tudoanh
Created July 31, 2024 04:39
Show Gist options
  • Save tudoanh/c44a053ccd9db09b01c1f86a543a5d6f to your computer and use it in GitHub Desktop.
Save tudoanh/c44a053ccd9db09b01c1f86a543a5d6f to your computer and use it in GitHub Desktop.
(function() {
'use strict';
function collectUrls() {
const urlPattern = /^https:\/\/www\.linkedin\.com\/company\/[a-zA-Z0-9-]+\/?$/;
const links = document.querySelectorAll('a');
const matchingUrls = [];
links.forEach(link => {
const href = link.href;
if (urlPattern.test(href)) {
matchingUrls.push(href);
}
});
console.log("Matching URLs:", matchingUrls);
}
window.addEventListener('load', function() {
setTimeout(collectUrls, 3000); // Allow some time for dynamic content to load
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment