Skip to content

Instantly share code, notes, and snippets.

@yotamss
Created October 3, 2025 10:08
Show Gist options
  • Select an option

  • Save yotamss/df58dc4962c2c33e1ecdf7ef344ec74b to your computer and use it in GitHub Desktop.

Select an option

Save yotamss/df58dc4962c2c33e1ecdf7ef344ec74b to your computer and use it in GitHub Desktop.
Fetch securitytrails domains
(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