需要安装 python-whois 库:pip install python-whois
import whois import time def is_registered(domain): try: w = whois.whois(domain) return bool(w.registrar or w.creation_date or w.name_servers) except Exception as e: print(f"Error checking {domain}: {e}") return True # 可根据具体错误判断 domains = ["example.com", "test.net", "demo.org", "notexist.xyz"] for domain in domains: registered = is_registered(domain) if registered: print(f"[REGISTERED] {domain}") else: print(f"[AVAILABLE] {domain}") time.sleep(1) #
网友回复