Skip to content

Instantly share code, notes, and snippets.

@smarteist
Last active February 21, 2025 16:59
Show Gist options
  • Save smarteist/9b49167a6d7911675f84aa5ec8512dd6 to your computer and use it in GitHub Desktop.
Save smarteist/9b49167a6d7911675f84aa5ec8512dd6 to your computer and use it in GitHub Desktop.
extractHrefsAsBashArray
(function extractHrefsAsBashArray() {
const domain = window.location;
const links = document.querySelectorAll('body main.container div.list table.table tbody tr td a');
const hrefsArray = Array.from(links).map(link => {
const href = link.getAttribute('href');
return href ? (href.startsWith('http') ? href : domain + href) : '';
}).filter(href => href);
console.log(`urls=(\n ${hrefsArray.map(href => `"${href}"`).join('\n ')}\n)`);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment