首先你要准备好 python3 的执行环境,并且安装 requests 库
如果没有 python3 执行环境,打开 https://www.anaconda.com/distribution/ ,下载对应操作系统的 anaconda 进行安装
然后访问 https://rapidapi.com ,注册好帐号,打开 https://rapidapi.com/domainr/api/domainr,通过绑定信用卡订阅 domainr 免费域名查询套餐,该套餐提供每月 10000 次的免费域名查询请求
python 查询代码如下
import requests, json
import time
F1 = open(r'C:\Users\Administrator\av.txt', 'w')#保存查询结果
domains_file = r'C:\Users\Administrator\domains.txt'#加载待查询域名
url = "https://domainr.p.rapidapi.com/v2/status"
headers = {
'x-rapidapi-host': "domainr.p.rapidapi.com",
'x-rapidapi-key': "rapidapi 密钥"
}
def get_domains():
with open(domains_file,'r',encoding='utf-8') as f:
domains = f.readlines()
domain_list = [i.strip() for i in domains]
return domain_list
domains = get_domains()
for i in range(len(domains)):
try:
querystring = {"domain":domains[i],"mashape-key":"rapidapi 密钥"}
response = requests.request("GET", url, headers=headers, params=querystring)
F1.write(domains[i]+":"+response.json()['status'][0]['status']+"\n")
except:
pass
time.sleep(2)#保证查询稳定性和可靠性
F1.close()
本人非计算机专业,没有经过系统科学的编程课程培训,所以比较菜,代码都是网上东拼西凑而成,经过测试基本可以满足需求
基于以上代码,我还做了一个 web 小应用,定期更新当前可以注册的二位后缀单字符域名,有兴趣的朋友可以看看
世界最短域名监控 https://yy.team/available-single-character-cctld-domains
1
lhx2008 2020-01-08 19:44:18 +08:00 via Android
1 万次还不够剔牙的,而且单字符域名一般都是注册不了的,只能联系注册局注册
|
2
wework OP @lhx2008 https://yy.team/available-single-character-cctld-domains 里面的都是可以直接注册
|
4
sobigfish 2020-01-14 14:32:26 +08:00
@wework #3 whois g.ps
Domain Name: g.ps Domain Status: Prohibited String - Object Cannot Be Registered Notes: This name is not allowed by the policy of this registry, and can not be registered URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/ |