![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
爬虫-python
文章平均质量分 58
shitfly
啥也不会
展开
-
Scrapy抓取W3C
因为web要开卷考试,准备把W3C上的东西爬下来去考试 用最简单的方法: spider.py:# -*- coding:utf-8 -*-import scrapyclass W3CSpider(scrapy.Spider): name='W3C' start_urls=[ 'http://www.w3school.com.cn/html/index.a原创 2017-05-24 13:53:00 · 406 阅读 · 0 评论 -
scrapy+xpath爬取不可描述网站
今天来爬一个让人很有动力的网站,网址就不便放上来了,看看有没有有缘人能得知了 还是先来items.pyimport scrapyclass AvmooItem(scrapy.Item): # define the fields for your item here like: # name = scrapy.Field() name=scrapy.Field()原创 2017-06-21 01:13:58 · 6619 阅读 · 0 评论 -
爬百度贴吧任一帖子
使用了urllib2和正则表达式#coding=utf-8import urllibimport urllib2import reclass Tool: removeImg=re.compile('<img.*?>| {7}|') #删除img标签,7位长空格 removeAddr=re.compile('<a.*?>|</a>') #删除超链接标签 replaceLi原创 2017-06-14 15:13:09 · 294 阅读 · 0 评论 -
使用scrapy+mongodb爬取豆瓣电影TOP250
使用了class scrapy.spiders.CrawlSpider rules 一个包含一个(或多个) Rule 对象的集合(list)。 每个 Rule 对爬取网站的动作定义了特定表现。 Rule对象在下边会介绍。 如果多个rule匹配了相同的链接,则根据他们在本属性中被定义的顺序,第一个会被使用。 parse_start_url(response) 当start_url的请求返回时,原创 2017-06-14 23:59:41 · 664 阅读 · 0 评论 -
scrapy+mongodb爬取红袖天香
借鉴了小白进阶之Scrapy第一篇 先来定义字段 items.pyimport scrapyclass HxtxItem(scrapy.Item): # define the fields for your item here like: name = scrapy.Field() author=scrapy.Field() novelurl=scrapy.Fi原创 2017-06-15 00:20:42 · 604 阅读 · 0 评论