Last active
September 5, 2020 22:52
-
-
Save itmayziii/1c7e29ba11a79892ffa330ed2052a5f6 to your computer and use it in GitHub Desktop.
Check a list of Domains from GoDaddy to see if they are available by calling their API. The GoDaddy API is limited to 60 requests per second so this script can be slow if you have a lot of domains.
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
/** | |
* Follow the docs here - https://developer.godaddy.com/getstarted to get credentials and learn about the Go Daddy Environments. | |
*/ | |
console.time('domain-testing') | |
// OTE | |
// const goDaddyDomain = 'api.ote-godaddy.com' | |
// const key = '' | |
// const secret = '' | |
// PROD | |
const goDaddyDomain = 'api.godaddy.com' | |
const key = '' | |
const secret = '' | |
const extension = 'io' | |
const domains = require('./domains.json') | |
const fetch = require('node-fetch') | |
const stream = require('stream') | |
class LookupDomainTransformStream extends stream.Transform { | |
constructor (options = {}) { | |
super(options) | |
// It would be ideal to use response headers from GoDaddy to know how many requests we had remaining, but they | |
// don't see to provide this, so we are assuming we can make 1 request for every second that passes (seems to work). | |
this.requestLeftPerMinute = 60 | |
this.interval = setInterval(() => { | |
if (this.requestLeftPerMinute < 60) { | |
this.requestLeftPerMinute += 1 | |
} | |
}, 1100) | |
} | |
_transform (domain, encoding, callback) { | |
if (!domain) { | |
return callback(null, null) | |
} | |
this.sendRequest(domain) | |
.then(response => { | |
return response.json() | |
.then(body => ({ response, body })) | |
}) | |
.then(({ response, body }) => { | |
if (response.status !== 200) { | |
console.error(`Non 200 status code received - ${response.status}`, body) | |
return callback() | |
} | |
if (!body.available) { | |
return callback(null, `${body.domain} - NOT AVAILABLE\n`) | |
} | |
callback(null, `${body.domain} - ${(body.price / 1000000).toFixed(2)} ${body.currency}\n`) | |
}) | |
.catch(callback) | |
} | |
sendRequest (domain) { | |
if (this.requestLeftPerMinute > 0) { | |
this.requestLeftPerMinute -= 1 | |
return fetch(`https://${goDaddyDomain}/v1/domains/available?domain=${domain}.${extension}`, { | |
headers: { Authorization: `sso-key ${key}:${secret}` } | |
}) | |
} | |
return new Promise(resolve => { | |
const interval = setInterval(() => { | |
if (this.requestLeftPerMinute > 0) { | |
clearInterval(interval) | |
this.requestLeftPerMinute -= 1 | |
resolve(fetch(`https://${goDaddyDomain}/v1/domains/available?domain=${domain}.${extension}`, { | |
headers: { Authorization: `sso-key ${key}:${secret}` } | |
})) | |
} | |
}, 1000) | |
}) | |
} | |
} | |
const lookupDomainTransformStream = new LookupDomainTransformStream() | |
lookupDomainTransformStream.on('end', () => process.exit()) | |
stream.pipeline( | |
stream.Readable.from(domains), | |
lookupDomainTransformStream, | |
process.stdout, | |
(error) => { | |
console.timeEnd('domain-testing') | |
if (error) { | |
console.error('error ', error) | |
return process.exit(1) | |
} | |
process.exit() | |
} | |
) |
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
[ | |
"abecedarian", | |
"abracadabra", | |
"accoutrements", | |
"adagio", | |
"aficionado", | |
"agita", | |
"agog", | |
"akimbo", | |
"alfresco", | |
"aloof", | |
"ambrosial", | |
"amok", | |
"ampersand", | |
"anemone", | |
"anthropomorphic", | |
"antimacassar", | |
"aplomb", | |
"apogee", | |
"apoplectic", | |
"appaloosa", | |
"apparatus", | |
"archipelago", | |
"atingle", | |
"avuncular", | |
"azure", | |
"babushka", | |
"bailiwick", | |
"bafflegab", | |
"balderdash", | |
"ballistic", | |
"bamboozle", | |
"bandwagon", | |
"barnstorming", | |
"beanpole", | |
"bedlam", | |
"befuddled", | |
"bellwether", | |
"berserk", | |
"bibliopole", | |
"bigmouth", | |
"bippy", | |
"blabbermouth", | |
"blatherskite", | |
"blindside", | |
"blob", | |
"blockhead", | |
"blowback", | |
"blowhard", | |
"blubbering", | |
"bluestockings", | |
"boing", | |
"boffo (boffola)", | |
"bombastic", | |
"bonanza", | |
"bonkers", | |
"boondocks", | |
"boondoggle", | |
"borborygmus", | |
"bozo", | |
"braggadocio", | |
"brainstorm", | |
"brannigan", | |
"breakneck", | |
"brouhaha", | |
"buckaroo", | |
"bucolic", | |
"buffoon", | |
"bugaboo", | |
"bugbear", | |
"bulbous", | |
"bumbledom", | |
"bumfuzzle", | |
"bumpkin", | |
"bungalow", | |
"bunkum", | |
"bupkis", | |
"burnsides", | |
"busybody", | |
"cacophony", | |
"cahoots", | |
"calamity", | |
"calliope", | |
"candelabra", | |
"canoodle", | |
"cantankerous", | |
"catamaran", | |
"catastrophe", | |
"catawampus", | |
"caterwaul", | |
"chatterbox", | |
"chichi", | |
"chimerical", | |
"chimichanga", | |
"chitchat", | |
"clandestine", | |
"claptrap", | |
"clishmaclaver", | |
"clodhopper", | |
"cockamamie", | |
"cockatoo", | |
"codswallop", | |
"collywobbles", | |
"colossus", | |
"comeuppance", | |
"concoction", | |
"conniption", | |
"contraband", | |
"conundrum", | |
"convivial", | |
"copacetic", | |
"corkscrew", | |
"cornucopia", | |
"cowabunga", | |
"coxcomb", | |
"crackerjack", | |
"crescendo", | |
"crestfallen", | |
"cryptozoology", | |
"cuckoo", | |
"curlicue", | |
"curmudgeon", | |
"demitasse", | |
"denouement", | |
"desperado", | |
"diaphanous", | |
"diddly-squat", | |
"digeridoo", | |
"dilemma", | |
"dillydally", | |
"dimwit", | |
"diphthong", | |
"dirigible", | |
"discombobulated", | |
"dodecahedron", | |
"doldrums", | |
"donkeyman", | |
"donnybrook", | |
"doodad", | |
"doohickey", | |
"doppelganger", | |
"dumbfounded", | |
"dumbwaiter", | |
"dunderhead", | |
"earwig", | |
"eavesdrop", | |
"ebullient", | |
"effervescence", | |
"egads", | |
"eggcorn", | |
"egghead", | |
"elixir", | |
"ephemeral", | |
"epiphany", | |
"eucatastrophe", | |
"extraterrestrial", | |
"finagle", | |
"fandango", | |
"festooned", | |
"fez", | |
"fiasco", | |
"fiddle-footed", | |
"fiddlesticks", | |
"finicky", | |
"firebrand", | |
"fishwife", | |
"fisticuffs", | |
"flabbergasted", | |
"flapdoodle", | |
"flibbertigibbet", | |
"flimflam", | |
"flippant", | |
"floccinaucinihilipilification", | |
"flophouse", | |
"flotsam", | |
"flummery", | |
"flummoxed", | |
"flyaway", | |
"flyspeck", | |
"folderol", | |
"foofaraw", | |
"foolhardy", | |
"foolscap", | |
"footloose", | |
"fopdoodle", | |
"fortuitous", | |
"fracas", | |
"frangipani", | |
"freewheeling", | |
"fricassee", | |
"frippery", | |
"frogman", | |
"froufrou", | |
"fuddy-duddy", | |
"fussbudget", | |
"futz", | |
"gadfly", | |
"gadzooks", | |
"gallimaufry", | |
"gangplank", | |
"gangway", | |
"gargoyle", | |
"gasbag", | |
"gazebo", | |
"gazpacho", | |
"gewgaw", | |
"genteel", | |
"ghostwriter", | |
"gibberish", | |
"gimcrack", | |
"gizmo", | |
"glabella", | |
"glitch", | |
"globetrotter", | |
"gobbledygook", | |
"gobsmacked", | |
"goosebump", | |
"gooseflesh", | |
"gorgonzola", | |
"gossamer", | |
"grandiloquent", | |
"greenhorn", | |
"guffaw", | |
"gumshoe", | |
"guru", | |
"gussied", | |
"guttersnipe", | |
"haberdashery", | |
"haboob", | |
"hairpin", | |
"halcyon", | |
"halfwit", | |
"hangdog", | |
"haphazard", | |
"harebrained", | |
"harumph", | |
"harum-scarum", | |
"headlong", | |
"heartstrings", | |
"heebie-jeebie", | |
"heirloom", | |
"helter-skelter", | |
"hemidemisemiquaver", | |
"heyday", | |
"higgledy-piggledy", | |
"highfalutin", | |
"hijinks", | |
"hillbilly", | |
"hippocampus", | |
"hippogriff", | |
"hobbledehoy", | |
"hobnobbed", | |
"hocus-pocus", | |
"hodgepodge", | |
"hogwash", | |
"hokum", | |
"hoodoo", | |
"hoodwink", | |
"hooey", | |
"hooligan", | |
"hoopla", | |
"hootenanny", | |
"hornswoggle", | |
"horsefeathers", | |
"hotbed", | |
"hotfoot", | |
"hothead", | |
"hubbub", | |
"hullabaloo", | |
"humbug", | |
"humdinger", | |
"humdrum", | |
"hunky-dory", | |
"hurly-burly", | |
"hushpuppy", | |
"huzzah", | |
"hyperbole", | |
"idiom", | |
"idiosyncrasies", | |
"igloo", | |
"ignoramus", | |
"impromptu", | |
"incognito", | |
"incorrigible", | |
"incredulous", | |
"indomitable", | |
"indubitably", | |
"infinitesimal", | |
"interloper", | |
"interrobang", | |
"ironclad", | |
"izzard", | |
"jabberwocky", | |
"jacuzzi", | |
"jalopy", | |
"jamboree", | |
"jargogle", | |
"jawbreaker", | |
"jetsam", | |
"jibber-jabber", | |
"jink", | |
"jitney", | |
"jubilee", | |
"juggernaut", | |
"jujubes", | |
"jumbo", | |
"junket", | |
"juxtaposition", | |
"kaleidoscope", | |
"kaput", | |
"kerfuffle", | |
"kerplunk", | |
"kibosh", | |
"killjoy", | |
"kismet", | |
"knickerbocker", | |
"knickknack", | |
"kowtow", | |
"kumquat", | |
"kvetch", | |
"lackadaisical", | |
"lagoon", | |
"lambasted", | |
"lampoon", | |
"landlubber", | |
"laughingstock", | |
"lexicographer", | |
"limburger", | |
"lingo", | |
"loco", | |
"loggerhead", | |
"logjam", | |
"logophile", | |
"logorrhea", | |
"lollapalooza", | |
"lollygag", | |
"loofah", | |
"loony", | |
"loophole", | |
"lugubrious", | |
"lummox", | |
"machinations", | |
"madcap", | |
"maelstrom", | |
"magnificent", | |
"majordomo", | |
"malapropism", | |
"malarkey", | |
"manifesto", | |
"mastermind", | |
"mayhem", | |
"mealymouthed", | |
"mellifluous", | |
"menagerie", | |
"miasma", | |
"miffed", | |
"milquetoast", | |
"misanthrope", | |
"mishmash", | |
"moocher", | |
"mojo", | |
"mollycoddle", | |
"mondegreen", | |
"moniker", | |
"monkeyshines", | |
"monsoon", | |
"mnemonic", | |
"moonstruck", | |
"muckety-muck", | |
"mudpuppy", | |
"mudslinger", | |
"muffuletta", | |
"mufti", | |
"mulligatawny", | |
"mumbo-jumbo", | |
"murmuration", | |
"muumuu", | |
"nabob", | |
"namby-pamby", | |
"nimrod", | |
"nincompoop", | |
"nitwit", | |
"nomenclature", | |
"nonplussed", | |
"noodge", | |
"nudnik", | |
"numbskull", | |
"onomatopoeia", | |
"oomph", | |
"orotund", | |
"outfox", | |
"outlandish", | |
"oxymoron", | |
"pachyderm", | |
"pagoda", | |
"palindrome", | |
"palomino", | |
"panache", | |
"pandemonium", | |
"pantaloons", | |
"papyrus", | |
"parabola", | |
"parallelogram", | |
"parapet", | |
"paraphernalia", | |
"peccadillo", | |
"pedagogue", | |
"peewee", | |
"pell-mell", | |
"persimmon", | |
"persnickety", | |
"pettifogger", | |
"phalanx", | |
"phantasmagorical", | |
"phantonym", | |
"phylactery", | |
"piffle", | |
"pizzazz", | |
"plethora", | |
"pogo", | |
"pogonip", | |
"pollex", | |
"pollywog", | |
"poltroon", | |
"pomposity", | |
"poppycock", | |
"portmanteau", | |
"potpourri", | |
"pseudonym", | |
"pugnacious", | |
"pulchritudinous", | |
"pusillanimous", | |
"pussyfoot", | |
"quibble", | |
"quicksilver", | |
"quicksticks", | |
"quiddle", | |
"quinzee", | |
"quirky", | |
"quixotic", | |
"quizzity", | |
"rabble-rouser", | |
"raconteur", | |
"rainmaker", | |
"ragamuffin", | |
"ragtag", | |
"ramshackle", | |
"ransack", | |
"rapscallion", | |
"razzle-dazzle", | |
"razzmatazz", | |
"rejigger", | |
"rendezvous", | |
"resplendent", | |
"rickrack", | |
"ricochet", | |
"riffraff", | |
"rigmarole", | |
"riposte", | |
"roundabout", | |
"roustabout", | |
"rubberneck", | |
"ruckus", | |
"ruffian", | |
"rugrat", | |
"rumpus", | |
"sabayon", | |
"sashay", | |
"sassafras", | |
"scalawag", | |
"scatterbrain", | |
"schadenfreude", | |
"schlep", | |
"schluffy", | |
"schmooze", | |
"schmutz", | |
"scintillating", | |
"scrofulous", | |
"scrumdiddlyumptious", | |
"scuttlebutt", | |
"serendipity", | |
"sesquipedalian", | |
"shabang", | |
"shenanigans", | |
"skedaddle", | |
"skirmish", | |
"skullduggery", | |
"slapdash", | |
"slapstick", | |
"slipshod", | |
"smithereens", | |
"smorgasbord", | |
"snollygoster", | |
"sobriquet", | |
"sojourn", | |
"spellbind", | |
"splendiferous", | |
"squeegee", | |
"squooshy", | |
"staccato", | |
"stupefaction", | |
"succotash", | |
"supercilious", | |
"superfluous", | |
"surreptitious", | |
"Svengali", | |
"swashbuckler", | |
"switcheroo", | |
"swizzlestick", | |
"synchronicity", | |
"syzygy", | |
"talisman", | |
"taradiddle", | |
"tchotchke", | |
"teepee", | |
"telekinesis", | |
"thingamabob", | |
"thingamajig", | |
"thunderstruck", | |
"tidbit", | |
"tintinnabulation", | |
"toadstool", | |
"toady", | |
"tomfoolery", | |
"tommyrot", | |
"toothsome", | |
"topsy-turvy", | |
"trapezoid", | |
"tub-thumper", | |
"tumultuous", | |
"typhoon", | |
"ululation", | |
"umlaut", | |
"umpteen", | |
"usurp", | |
"uvula", | |
"vagabond", | |
"vamoose", | |
"verboten", | |
"verisimilitude", | |
"vermicious", | |
"vertigo", | |
"verve", | |
"virtuoso", | |
"vivacious", | |
"vuvuzela", | |
"wackadoodle", | |
"wallflower", | |
"wanderlust", | |
"whatchamacallit", | |
"whatsis", | |
"whimsical", | |
"whippersnapper", | |
"whirligig", | |
"whirlybird", | |
"whizbang", | |
"whodunit", | |
"whoop", | |
"widget", | |
"wigwam", | |
"willy-nilly", | |
"windbag", | |
"wipeout", | |
"wiseacre", | |
"wisecrack", | |
"wisenheimer", | |
"wishy-washy", | |
"woebegone", | |
"wonky", | |
"woozy", | |
"wordplay", | |
"wordsmith", | |
"wunderkind", | |
"wuthering", | |
"xylophone", | |
"yahoo", | |
"yokel", | |
"yo-yo", | |
"zaftig", | |
"zeitgeist", | |
"zenzizenzizenzic", | |
"zephyr", | |
"zeppelin", | |
"ziggurat", | |
"zigzag", | |
"zonked", | |
"zoom", | |
"zydeco" | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment