python爬虫实验
2014-02-13 00:00
274 查看
那天在新浪微博上看到北北出的题目,由于最近也在做类似的爬虫研究,所以就有了这个实验。
后来在QQ上和北北说了下,要求是啥都抓,就抓乌云的。。。
然后就开始了。。
第一个版本如下,后续不断改进直到满足需求:
后来在QQ上和北北说了下,要求是啥都抓,就抓乌云的。。。
然后就开始了。。
第一个版本如下,后续不断改进直到满足需求:
import urllib2; from sgmllib import SGMLParser; class CatCh(SGMLParser): def reset(self): self.url=[] SGMLParser.reset(self) def start_a(self,attrs): href = [v for k, v in attrs if k == 'href'] if href: self.url.extend(href) content = urllib2.urlopen("http://wooyun.org/").read() catch=CatCh() catch.feed(content) for item in catch.url: print item
相关文章推荐
- python爬虫实验2
- 关于python爬虫的积累和实验
- python使用第三方函数库及简单爬虫实验
- python的小实验代码的备份,主要偏向于爬虫方向,难点是正则表达式和编码转换[入门]
- python3爬虫之入门和正则表达式
- Python爬虫入门教程
- [记录]Python爬虫过程中遇到的简单带干扰线验证码处理方法
- Python爬虫例子
- python库学习笔记——爬虫常用的BeautifulSoup的介绍
- Python简单的爬虫
- python爬虫 利用cookie登录人人网
- python3.3 爬虫小例子
- python3.5小爬虫—爬糗事百科
- python爬虫(1)利用BeautifulSoup进行网络数据采集
- python 爬虫学习篇1
- Python爬虫之urllib2笔记
- python爬虫学习--pixiv爬虫(4)--代码优化
- 基于正则表达式(python)对东方财富网上证指数吧爬虫实例
- python 爬虫基础笔记(一)