Created
March 19, 2021 10:46
-
-
Save franky47/093e9f89e599f6b142545406cc38fab3 to your computer and use it in GitHub Desktop.
List all the Tweet URLs on the page
This file contains 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
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