Skip to content

Instantly share code, notes, and snippets.

@franciscop
Created October 27, 2022 15:19
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 franciscop/389836d9e42ee64bebd2a38c06b8ae7d to your computer and use it in GitHub Desktop.
Save franciscop/389836d9e42ee64bebd2a38c06b8ae7d to your computer and use it in GitHub Desktop.
Find the cheapest TLD domains with Gandi.net
// Search Gandi.net for the cheapest domains
// Make sure you have expanded the list in gandi.net search to the end!
(() => {
const RESULTS = 10;
const ROW_SEL = '.ListCellGroup-root_29bXw';
const DOMAIN_SEL = '.FqdnCell-textBreak__elahz';
const PRICE_SMALL = '.Text-align-end_3rH75';
const PRICE_LARGE = '.PriceText-root__lJT6S';
const list = $$(ROW_SEL).map(it => {
const getText = sel => it.querySelector(sel)?.innerText;
const domain = getText(DOMAIN_SEL);
const rawPrice = getText(PRICE_SMALL) || getText(PRICE_LARGE);
const price = +rawPrice
.replace(/\/\d years/, '')
.replace('/year', '')
.replace('then', '')
.replace('$', '')
.replace(',', '')
.trim();
return [domain, price];
});
const top = list.sort((a, b) => a[1] - b[1]).slice(0, RESULTS);
alert(top.map(p => `\$${p[1]} • ${p[0]}`).join('\n'));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment