批量检查域名是否可以注册
1、有的网站数据是通过下拉发生请求,间隔x毫秒自动下拉
2、查找某个关键字,找到就打印出来
3、打印数据自动去重
4、当连续n次下拉,没有新div元素出来,就停止该循环
var map = {};
var count = 0;
var lastLength = 0;
var intervalId = setInterval(function () {
window.scrollBy(0, 1000);
var items = document.querySelectorAll(".common-buy__item__main");
var currentLength = items.length;
if (currentLength === lastLength) {
count++;
} else {
count = 0;
}
lastLength = currentLength;
items.forEach(function (item) {
var price = item.querySelector(".buy-digital-unit"); // 查找是否包含"元/首年"的div
if (price && price.innerText === "元/首年") {
var domain = item.querySelector("span.common-buy__item__domain").getAttribute("title");
if (domain && map[domain] != true) {
console.log(domain);
map[domain] = true;
}
}
});
if (count === 10) {
clearInterval(intervalId);
console.log("结束:",intervalId);
}
}, 3000);
一些基础知识:
.com
域名中,3位数的纯数字、纯字母、数字字母混合都被注册完了了
.com
域名中,4位数的纯数字、纯字母被注册完了,数字+字母仍有很多未注册