Created
October 3, 2025 10:08
-
-
Save yotamss/df58dc4962c2c33e1ecdf7ef344ec74b to your computer and use it in GitHub Desktop.
Fetch securitytrails domains
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
| (async function scrapeDomains() { | |
| const allDomains = []; | |
| async function getDomainsFromPage() { | |
| const domainLinks = document.querySelectorAll('table.ui-table tbody tr td:first-child a.link'); | |
| const domains = Array.from(domainLinks).map(link => link.textContent.trim()); | |
| allDomains.push(...domains); | |
| } | |
| async function clickNext() { | |
| // Find the "›" button | |
| const nextButton = Array.from(document.querySelectorAll('ul.tooltip a')) | |
| .find(a => a.textContent.trim() === '›'); | |
| if (!nextButton) return false; // No next button at all | |
| // Check if it's disabled | |
| const isDisabled = nextButton.classList.contains('pointer-events-none'); | |
| if (isDisabled) return false; | |
| nextButton.click(); | |
| await new Promise(resolve => setTimeout(resolve, 1500)); // Wait for page to load | |
| return true; | |
| } | |
| let hasNext = true; | |
| while (hasNext) { | |
| await getDomainsFromPage(); | |
| hasNext = await clickNext(); | |
| } | |
| console.log("All domains:", allDomains); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment