Thursday, May 16, 2024
HomePythonExamine If a Checklist of ENS (.eth) Domains are Obtainable? (Python) –...

Examine If a Checklist of ENS (.eth) Domains are Obtainable? (Python) – Finxter


You’ll be able to test programmatically in Python whether or not a sure ENS '.eth‘ area identify is offered by utilizing the urlopen() operate from urllib.request module to entry the URL 'https://etherscan.io/enslookup-search?search=instance.eth', changing the URL suffix 'instance.eth' together with your desired area.

Within the following instance code snippet, I present how you would test a listing of names, one area identify per line, in opposition to the Etherscan URL and scrape the ensuing HTML response to seek out out whether or not every area is offered, or not.

💡 DYI: You’ll be able to copy&paste your listing of candidate .eth names as proven within the instance and run it in your pc or in a Jupyter Pocket book. The code will present you a listing of ENS domains which are nonetheless out there.

from urllib.request import Request, urlopen
import time

# Copy your listing of names right here:
list_of_names=""'
Google
Apple
Amazon
Microsoft
Tencent
Fb
Visa
McDonald's
Alibaba
AT&T
IBM
Verizon
Marlboro
Coca-Cola
Mastercard
UPS
SAP
Wells Fargo
Disney
The Residence Depot
China Cell
ICBC
Starbucks
Xfinity
Deutsche Telekom
Louis Vuitton
Spectrum
GE
Nike
PayPal
Walmart
Accenture
Samsung
Moutai
American Categorical
Toyota
Vodafone
Intel
Hermes
Budweiser
Baidu
Zara
Ping An
L'Oreal Paris
Oracle
Mercedes-Benz
BMW
Huawei
China Development Financial institution
HSBC
YouTube
RBC
Movistar
Gucci
NTT
FedEx
Cisco
Citi
JD.com
HDFC Financial institution
Netflix
DHL
Shell
Pampers
Orange
TD
Chase
Commonwealth Financial institution of Australia
Agricultural Financial institution of China
Subway
Colgate
Costco
J.P. Morgan
ExxonMobil
Adobe
IKEA
Financial institution of America
Salesforce
China Life
US Financial institution
Uber
Siemens
LinkedIn
Financial institution of China
Gillette
AIA
KFC
Ebay
HP
SF Categorical
Instagram
ANZ
ALDI
BT
Lowe's
Ford
Honda
Pepsi
BCA
Adidas
'''

# Mechanically extract domains from listing
names = [x.strip().lower().replace("'", '').replace(' ', '').replace('.','') + '.eth' for x in list_of_names.split()]
print(names)

# For checking the .eth area identify
url="https://etherscan.io/enslookup-search?search="
negative_text = b'The area identify entered is both not registered on ENS or not at the moment supported by Etherscan.'

# Maintain observe of all free domains
free_domains = []

for identify in names:
  ens_url = url + identify
  req = Request(
    url=ens_url, 
    headers={'Consumer-Agent': 'Mozilla/5.0'}
  )
  webpage = urlopen(req).learn()
  if negative_text in webpage:
    free_domains.append(identify)
    print(identify, ' out there')
  else:
    print('xxx ', identify, ' xxx')
  time.sleep(1)

print('Free Domains: ', 'n'.be part of(free_domains))

The variable free_domains incorporates all ENS .eth domains out of your listing which are nonetheless out there.

💡 Really helpful Tutorial: Get a Web site From a Given URL in Python?


RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments