Created
September 12, 2018 14:50
-
-
Save gorka/e8c4f7b08dbf09582618e0613c094089 to your computer and use it in GitHub Desktop.
Get available domains in https://zeit.co/domains?q=DOMAIN sorted by domain length and price
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.prototype.map.call(document.querySelectorAll('button.INTERNAL_AVAILABLE'), e => { | |
const tld = e.querySelector('.tld-part').innerText | |
return { | |
tld, | |
tldLength: tld.split('').length, | |
price: Number(e.querySelector('.price').childNodes[1].textContent) | |
}} | |
) | |
.reduce((acc, curr) => { | |
(acc[curr.tldLength] = acc[curr.tldLength] || []).push(curr) | |
acc[curr.tldLength].sort((a, b) => a.price - b.price) | |
return acc | |
}, {}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment