Last active
February 21, 2025 16:59
-
-
Save smarteist/9b49167a6d7911675f84aa5ec8512dd6 to your computer and use it in GitHub Desktop.
extractHrefsAsBashArray
This file contains hidden or 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 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