python自定义域名批量查询注册工具

2023-07-05T10:44:00

思路 自定义关键词=>阿里API=>查询结果保存本地txt

 # -*- coding:UTF-8 -*-
import requests
from bs4 import BeautifulSoup
import re

def xfun():
    S1 = 'abcdefghijklmnopqrstuvwxyz'
    S2 = 'abcdefghijklmnopqrstuvwxyz'
    S3 = 'abcdefghijklmnopqrstuvwxyz'
    l = [a+b+c for a in S1 for b in S2 for c in S3]
    return l


def domain(k1,k2,h):
    val1=str(k1)+str(k2)+'.'+str(h)
    print(val1)
    domain_new="https://checkapi.aliyun.com/check/checkdomain?domain=%s&command=&token=Y847a5e60c85b0f08e40bba55aa021566&ua=&currency=&site=&bid=&_csrf_token=&callback=jsonp_1538051895584_24373" %val1 #阿里查找域名API
    r2=requests.get(url=domain_new,timeout=100)
    soup2=BeautifulSoup(r2.text,'lxml')
    html=soup2.text
    lists =re.findall('"avail":0', html)
    if lists:#判断list是否为空
        print(val1+'已注册')
    else:
        with open('/Users/yangxin/Desktop/可以注册域名.txt', 'a') as f:#将可以注册内容写进txt
            print(val1+'可以注册')
            f.write('注册域名:'+val1+'\n')
            f.close()


for k in xfun():
    domain(k,2,com)#2为自定义关键词,com为自定义域名后缀
    pass
当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »