Skip to content

Instantly share code, notes, and snippets.

@elotroalex
Created October 26, 2023 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elotroalex/a1368beabd28c24f67ffb1e823e0079f to your computer and use it in GitHub Desktop.
Save elotroalex/a1368beabd28c24f67ffb1e823e0079f to your computer and use it in GitHub Desktop.
Get a list of URLs from a page
console.log([...new Set([...document.querySelectorAll('a')].filter(a=>a.href.match('pdf')).map(a=>a.href.replace(/\/[^\/]+\.pdf.*$/,'')))].join('\n'))
console.log([...new Set([...document.querySelectorAll('a')].filter(a=>a.href.match('155-publications')).map(a=>a.href.replace(/155\-publications.*$/,'155-publications')))].join('\n'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment