Для поиска доменных имен можно использовать несколько популярных веб-сайтов и методов. Вот некоторые из лучших веб-сайтов для поиска доменов, а также примеры кода для проверки доступности домена:
-
Namecheap (API: https://www.namecheap.com/support/api/intro/ )
import requests def check_domain_availability(domain): api_key = "YOUR_API_KEY" api_username = "YOUR_USERNAME" url = f"https://api.namecheap.com/xml.response?ApiUser={api_username}&ApiKey={api_key}&UserName={api_username}&Command=namecheap.domains.check&DomainList={domain}" response = requests.get(url) # Parse the XML response and check domain availability # Return True if available, False otherwise domain = "example.com" is_available = check_domain_availability(domain) -
GoDaddy (API: https://developer.godaddy.com/getstarted )
import requests def check_domain_availability(domain): api_key = "YOUR_API_KEY" api_secret = "YOUR_API_SECRET" url = f"https://api.godaddy.com/v1/domains/available?domain={domain}" headers = { "Authorization": f"sso-key {api_key}:{api_secret}" } response = requests.get(url, headers=headers) # Parse the JSON response and check domain availability # Return True if available, False otherwise domain = "example.com" is_available = check_domain_availability(domain) -
Поиск WHOIS (библиотека Python: https://pypi.org/project/python-whois/ )
import whois def check_domain_availability(domain): try: w = whois.whois(domain) if w.status is None: return True else: return False except whois.parser.PywhoisError: return False domain = "example.com" is_available = check_domain_availability(domain) -
Domain.com (API: https://www.domain.com/api/docs/ )
import requests def check_domain_availability(domain): api_key = "YOUR_API_KEY" url = f"https://api.domain.com/v1/domains/availability?domain={domain}" headers = { "Authorization": f"Bearer {api_key}" } response = requests.get(url, headers=headers) # Parse the JSON response and check domain availability # Return True if available, False otherwise domain = "example.com" is_available = check_domain_availability(domain) -
Google Domains (публичный API недоступен)
Чтобы проверить доступность домена в Google Domains, вы можете использовать методы очистки веб-страниц с такими библиотеками, как BeautifulSoup или Selenium. Вот упрощенный пример использования BeautifulSoup:
import requests
from bs4 import BeautifulSoup
def check_domain_availability(domain):
url = f"https://domains.google.com/registrar?s={domain}"
response = requests.get(url)
soup = BeautifulSoup(response.text, "html.parser")
availability = soup.find("span", class_="availability-text").text
if availability == "Looks good!":
return True
else:
return False
domain = "example.com"
is_available = check_domain_availability(domain)