Skip to content

Instantly share code, notes, and snippets.

@franky47
Created March 19, 2021 10:46
Show Gist options
  • Save franky47/093e9f89e599f6b142545406cc38fab3 to your computer and use it in GitHub Desktop.
Save franky47/093e9f89e599f6b142545406cc38fab3 to your computer and use it in GitHub Desktop.
List all the Tweet URLs on the page
Array.from(
new Set(
// List all links on the page
Array.from(document.getElementsByTagName('a'))
.filter(a =>
// Only keep status URLs
a.href.match(/^https:\/\/twitter\.com\/(\w+)\/status\/(\d+)$/)
)
.map(a => a.href) // Keep only the link URL
) // new Set: remove duplicates
) // Back to array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment