在爬取一个网站时,又是我们需要查看一个网站的所有者相关信息,这时就可以用到whois这个模块
step1: 使用pip install python-whois安装whois模块
(/Users/jockie/install_programs/anaconda) jockie:~/programs/pycharm$ pip install python-whois
Collecting python-whois
Downloading python-whois-0.6.5.tar.gz
Collecting future (from python-whois)
Downloading future-0.16.0.tar.gz (824kB)
100% |################################| 829kB 137kB/s
Building wheels for collected packages: python-whois, future
Running setup.py bdist_wheel for python-whois ... done
Stored in directory: /Users/jockie/Library/Caches/pip/wheels/37/68/27/819a3f07cbe75200d8cfa74d4517fd0f402b6dd7aaf91afe8b
Running setup.py bdist_wheel for future ... done
Stored in directory: /Users/jockie/Library/Caches/pip/wheels/c2/50/7c/0d83b4baac4f63ff7a765bd16390d2ab43c93587fac9d6017a
Successfully built python-whois future
Installing collected packages: future, python-whois
Successfully installed future-0.16.0 python-whois-0.6.5
step2: 使用whois
In [1]: import whois
In [2]: whois.whois('xuanxiewu.com')
Out[2]:
{'address': 'NanJingShiYuHuaTaiQuXiShanQiaoMeiXinXiaoQu',
'city': 'Nanjing',
'country': 'CN',
'creation_date': datetime.datetime(2014, 9, 28, 4, 9, 31),
'dnssec': 'unsigned',
'domain_name': ['XUANXIEWU.COM', 'xuanxiewu.com'],
'emails': ['tld@cndns.com', 'domain@cndns.com', '1044699649@qq.com'],
'expiration_date': [datetime.datetime(2018, 9, 28, 4, 9, 31),
datetime.datetime(2018, 9, 28, 12, 7, 1)],
'name': 'qiang jiong',
'name_servers': ['F1G1NS1.DNSPOD.NET',
'F1G1NS2.DNSPOD.NET',
'f1g1ns1.dnspod.net',
'f1g1ns2.dnspod.net'],
'org': 'qiang jiong',
'referral_url': None,
'registrar': 'SHANGHAI MEICHENG TECHNOLOGY INFORMATION DEVELOPMENT CO., LTD.',
'state': 'Jiangsu',
'status': ['clientTransferProhibited https://icann.org/epp#clientTransferProhibited',
'ok https://icann.org/epp#ok'],
'updated_date': [datetime.datetime(2017, 6, 19, 15, 33, 50),
datetime.datetime(2017, 6, 19, 23, 33, 51)],
'whois_server': 'grs-whois.cndns.com',
'zipcode': '210041'}