Skip to content

Instantly share code, notes, and snippets.

@softplus
Created February 9, 2024 15:31
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 softplus/4478287922aec52976a3d9e720a398b1 to your computer and use it in GitHub Desktop.
Save softplus/4478287922aec52976a3d9e720a398b1 to your computer and use it in GitHub Desktop.
Extract all unique links from the current page using Chrome Devtools
// JavaScript, of course
const urls = [...new Set($$('a').map((x) => x.href))]
// for non-Devtools usage (extension, etc), use document.getElementsByTagName('a') instead of $$('a')
// ... and spread them into an array:
const urls = [...new Set([...document.getElementsByTagName('a')].map((x) => x.href))]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment