Skip to content

Instantly share code, notes, and snippets.

@Asbra
Last active July 3, 2023 16:01
Show Gist options
  • Save Asbra/11f98fc50d502973739febd43ce3e614 to your computer and use it in GitHub Desktop.
Save Asbra/11f98fc50d502973739febd43ce3e614 to your computer and use it in GitHub Desktop.
JS bulk domain search on NameCheap
// Needed to check a large amount of domains quickly and
// NameCheap UI can be really sluggish ..
// Script needs to be run from NameCheap.com
// To find current client_id go on a NameCheap search page,
// such as https://namecheap.com/domains/registration/results.aspx?domain=google&tlds=com
// Open source code, search for .cloudfront.net/search.js
// In that script search for {domainr:"
var client_id = "fb7aca826b084569a50cfb3157e924ae";
function searchDomains(domains, tld, only_available=false) {
if (!domains) { return false; }
if (typeof domains == "string") { domains = [domains]; }
if (tld && tld !== undefined) {
domains.forEach(function(value,index,array){
domains[index] = value+"."+tld;
});
}
jQuery.getJSON("https://api.domainr.com/v2/status?domain="+domains.join(",")+"&client_id="+client_id, function(data){
jQuery.each(data.status, function(k,o){
if (o.status.indexOf("inactive") > -1) {
if (o.summary == "reserved" && !only_available) {
console.log(o.domain, "is reserved :(");
} else if (o.summary == "premium" && !only_available) {
console.log(o.domain, "is premium :(");
} else if (o.summary == "inactive") {
console.log(o.domain, "is available! :)");
}
} else if (!only_available) {
console.log(o.domain, "is NOT available :(");
}
console.debug(JSON.stringify(o));
});
});
}
@Asbra
Copy link
Author

Asbra commented Aug 3, 2017

Added "tld" argument to search multiple domains with a single TLD.
Added messages for if domain is reserved or resold as premium domain.

@thaikolja
Copy link

The client_id variable/value is no longer available in any parts of the source code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment