错误:DNS 探测已完成 NXDOMAIN

问题描述 投票:0回答:1

我尝试从 URL 数据集中传递域并从 whois 数据库中获取域。

但是,当我运行 Jupyter notebook 时,它卡住了。

功能:

def get_features(url,label):
    
    features = []
    ....
    
    dnsrecord = 0
    try:
        domain = whois.whois(urlparse(url).netloc)
    except:
        dnsrecord = 1 
     
    features.append(dnsrecord)
    
    ....
    return features 

运行:

features = []
    
for i in range (0,len(df)):
    url = df['url'][i]
    label = df['label'][i]
    features.append(feature_extraction(url,label))

我去搜索网页,显示如下:

This site can’t be reached
Check if there is a typo in www.content.usatoday.com.
If spelling is correct, try running Windows Network Diagnostics.
DNS_PROBE_FINISHED_NXDOMAIN

当网页是“DNS_PROBE_FINISHED_NXDOMAIN”时,除了这种情况如何制作?

python jupyter-notebook whois
1个回答
0
投票

检查域名是否不存在或DNS服务器有问题

尝试将您的代码修改为

import socket

def get_features(url,label):
features = []
....

dnsrecord = 0
try:
    domain =       whois.whois(urlparse(url).netloc)
except socket.gaierror:
    dnsrecord = 1 
 
features.append(dnsrecord)

....
return features 
© www.soinside.com 2019 - 2024. All rights reserved.