代码改变世界

pyhton

2014-11-11 07:23  anjsoft  阅读(171)  评论(0编辑  收藏  举报

http://panda.www.net.cn/cgi-bin/check.cgi?area_domain=

http://whois.chinaz.com/

beautifulsoup4

import xml.dom.minidom
import urllib
name = "baidu.com"
text = urllib.urlopen("http://panda.www.net.cn/cgi-bin/check.cgi?area_domain="+name)
# req = urllib.urlopen("http://whois.chinaz.com/"+name)
text = text.read().decode("gb2312").encode("utf-8")
text = text.replace(" encoding=\"gb2312\"?>"," encoding=\"utf-8\"?>")
print text
doc = xml.dom.minidom.parseString(text)
print doc.getElementsByTagName("original").parseString()