for domain in domains:
url = fhttps://www.whoisxmlapi.com/whoisserver/WhoisService?apiKey={api_key}&domainName={domain}&outputFormat=JSON
response = requests.get(url)
data = response.json()
status = data.get(whoisRecord, {}).get(status)
print(f{domain}: {status})
二、本地脚本实现(Python 示例)
你可以用 Python 编写脚本批量查询域名是否可用(基于 whois 协议):
python
import whois
import time
def check_domain_availability(domain):
try:
w = whois.whois(domain)
return False 已注册
except Exception as e:
return True 可用
读取域名列表
with open(domains.txt, r) as f:
domains = [line.strip() for line in f]
批量查询
results = {}
for domain in domains:
available = check_domain_availability(domain)
results[domain] = Available if available else Taken
time.sleep(1) 避免频繁请求
输出结果
for domain, status in results.items():
print(f{domain}: {status})
✅ 安装依赖:`pip install python-whois`
三、注意事项
1、遵守 robots.txt 和服务条款:避免高频请求导致 IP 被封。
2、使用代理或限速:大批量查询建议每秒不超过 1~2 次。
3、注意隐私保护:不要公开敏感域名列表。
4、域名后缀:不同后缀(.com/.cn/.net)需单独查询。
四、推荐流程(企业级操作)
1、准备域名列表(文本文件)
2、使用 API 或脚本逐个查询
3、导出结果为 CSV / Excel
4、标记可用域名用于注册