今天在用scrapy爬虫时,报了下面的错误:
2019-01-17 16:47:18 [scrapy.dupefilters] DEBUG: Filtered duplicate request: <GET https://newhouse.fang.com/house/s/b95/> - no more duplicates will be shown (see DUPEFILTER_DEBUG to show all duplicates)
2019-01-17 16:47:18 [scrapy.core.engine] INFO: Closing spider (finished)
2019-01-17 16:47:18 [scrapy.statscollectors] INFO: Dumping Scrapy stats:
{'downloader/request_bytes': 2653,
'downloader/request_count': 7,
'downloader/request_method_count/GET': 7,
'downloader/response_bytes': 220568,
'downloader/response_count': 7,
'downloader/response_status_count/200': 7,
'dupefilter/filtered': 1,
'finish_reason': 'finished',
'finish_time': datetime.datetime(2019, 1, 17, 8, 47, 18, 37428),
'log_count/DEBUG': 9,
'log_count/INFO': 7,
'request_depth_max': 7,
'response_received_count': 7,
'scheduler/dequeued': 7,
'scheduler/dequeued/memory': 7,
'scheduler/enqueued': 7,
'scheduler/enqueued/memory': 7,
'start_time': datetime.datetime(2019, 1, 17, 8, 47, 5, 279308)}
2019-01-17 16:47:18 [scrapy.core.engine] INFO: Spider closed (finished)
原因:在爬虫出现了重复的链接,重复的请求,出现这个DEBUG或者是yield scrapy.Request(xxxurl,callback=self.xxxx)中有重复的请求其实scrapy自身是默认有过滤重复请求的让这个DEBUG不出现,可以有 dont_filter=True,在Request中添加可以解决
yield scrapy.Request(xxxurl,callback=self.xxxx,dont_filter=True)