Created
October 27, 2022 15:19
-
-
Save franciscop/389836d9e42ee64bebd2a38c06b8ae7d to your computer and use it in GitHub Desktop.
Find the cheapest TLD domains with Gandi.net
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
// 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