你想知道某个站点的所有者是谁么?网络爬虫工具之WHOIS协议的使用
目录
更多分享:http://www.catbro.cn
一、前言:
- 在爬取一些网站的时候,我们可能会关心其所有者是谁。因为像Google这些,我们最好把下载速度控制得更加保守一些,不然很容易我们的爬虫就会被封了哦。为了找到网站的所有者,我们可以使用
WHOIS
协议查询域名的注册者是谁。Pyton
中有一个针对该协议的封 装库,其文档地址为https://pypi.python.org/pypi/python-whois
,我们可以通过pip
进行安装。
二、安装使用
-
1、执行
pip3 install python-whois
,如果你在Python2
开发环境下,可以执行pip install python-whois
-
2、安装后我们来验证一下吧
import whois print(whois.whois('baidu.com')) #执行结果 { "domain_name": [ "BAIDU.COM", "baidu.com" ], "registrar": "MarkMonitor, Inc.", "whois_server": "whois.markmonitor.com", "referral_url": "http://www.markmonitor.com", "updated_date": [ "2015-09-10 00:00:00", "2017-02-13 01:04:21-08:00" ], "creation_date": [ "1999-10-11 00:00:00", "1999-10-11 04:05:17-07:00" ], "expiration_date": [ "2017-10-11 00:00:00", "2017-10-11 00:00:00-07:00" ], "name_servers": [ "DNS.BAIDU.COM", "NS2.BAIDU.COM", "NS3.BAIDU.COM", "NS4.BAIDU.COM", "NS7.BAIDU.COM", "ns3.baidu.com", "ns2.baidu.com", "dns.baidu.com", "ns4.baidu.com", "ns7.baidu.com" ], "status": [ "clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited", "clientTransferProhibited https://icann.org/epp#clientTransferProhibited", "clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited", "serverDeleteProhibited https://icann.org/epp#serverDeleteProhibited", "serverTransferProhibited https://icann.org/epp#serverTransferProhibited", "serverUpdateProhibited https://icann.org/epp#serverUpdateProhibited", "clientUpdateProhibited (https://www.icann.org/epp#clientUpdateProhibited)", "clientTransferProhibited (https://www.icann.org/epp#clientTransferProhibited)", "clientDeleteProhibited (https://www.icann.org/epp#clientDeleteProhibited)", "serverUpdateProhibited (https://www.icann.org/epp#serverUpdateProhibited)", "serverTransferProhibited (https://www.icann.org/epp#serverTransferProhibited)", "serverDeleteProhibited (https://www.icann.org/epp#serverDeleteProhibited)" ], "emails": [ "abusecomplaints@markmonitor.com", "domainmaster@baidu.com" ], "dnssec": "unsigned", "name": "Domain Admin", "org": "Beijing Baidu Netcom Science Technology Co., Ltd.", "address": "3F Baidu Campus No.10, Shangdi 10th Street Haidian District", "city": "Beijing", "state": "Beijing", "zipcode": "100085", "country": "CN" }