用 python 获取域名列表 再进行备案查询
2013-08-21 14:24
721 查看
需要在众多的二手域名中查询他的备案信息,
需要安装beautifulSoup,进行提取,原来是想将内容都获取出来,但是由于批量查询的网站不支持抓取,也没有继续研究,就直接用webbrowser了
http://blog.csdn.net/csapr1987/article/details/9329461
这个是域名列表的源 http://www.wy888.com/news.asp
获取了域名之后,进行拼凑url
每次打开5个页面,否则机器受不了,就是每次进行网页查询50个域名
在http://beian.links.cn下进行查询,需要对这个网站说Thx,
需要安装beautifulSoup,进行提取,原来是想将内容都获取出来,但是由于批量查询的网站不支持抓取,也没有继续研究,就直接用webbrowser了
http://blog.csdn.net/csapr1987/article/details/9329461
这个是域名列表的源 http://www.wy888.com/news.asp
获取了域名之后,进行拼凑url
url ='http://beian.links.cn/beian.asp?domains=mp1973.com'+l
每次打开5个页面,否则机器受不了,就是每次进行网页查询50个域名
在http://beian.links.cn下进行查询,需要对这个网站说Thx,
#-*- coding: utf-8 -*- # by sunlei import datetime import urllib2 import httplib import re import bs4 import webbrowser from bs4 import BeautifulSoup class findurl: def __init__(self,url): self.url=url def read(self): req=self.url try: webpage= urllib2.urlopen(req) data=webpage.read() except: print 'wrong' return 'error' self.data = data def findcom(self): self.listcom=[] soup = BeautifulSoup(self.data) lista=soup.findAll(text=re.compile("com")) #根据需要自行修改 self.listcom=lista def listcom(self): self.read() self.findcom() return self.listcom class readbeian: def __init__(self,listcom): self.listcom=listcom def writeurl(self): self.lista=[] for i in range(0,len(self.listcom),9): a=self.listcom[i:i+9] b='' for j in a: b=b+'%0D%0A'+j self.lista.append(b) return self.lista def readbeian(self): for i in range(0,len(self.lista),5): listl=self.lista[i:i+5] for l in listl: url ='http://beian.links.cn/beian.asp?domains=mp1973.com'+l webbrowser.open(url, new=0,autoraise=1) a=raw_input('继续打开5个网页 Y or N') if a=='Y': continue a=findurl('http://www.wy888.com/news.asp') b=readbeian(a.listcom()) print b.writeurl() b.readbeian()
相关文章推荐
- Python中模块pymysql查询结果后如何获取字段列表
- 从url获取域名 python
- Oracle数据库中字段定义为Char类型,Hibernate用该字段进行动态绑定参数查询,获取不到结果的问题
- 集团信息化之路 为电子采购系统申请域名并进行备案
- 用Python读取指定文件夹下的所有Landsat影像,并根据影像获取时间对文件名进行排序
- 如何科学地蹭热点:用python爬虫获取热门微博评论并进行情感分析
- Python rPyc 模块应用:在远端上执行命令,并且获取查询结果
- 使用ObjectUtil进行深度复制及获取对象的属性名称列表
- 搬砖中的小事之代码(六)--列表显示的字段与数据库中字段类型不匹配,需要在查询后进行简单转换
- 在sharepoint中 使用SPSiteDataQuery来进行跨列表查询
- python里使用协程获取域名解释
- python 获取指定文件列表
- Python批量获取京东商品列表信息
- python获取的信息列表微信公共平台和用户头像
- python.map() 对列表进行映射
- 使用Python模拟登录QQ邮箱获取QQ好友列表
- Python中如何获取类属性的列表
- python3批量查询域名是否注册
- python获取指定目录下所有文件名列表的方法
- python - 对字符列表进行组合输出