本文介绍了如何忽略Scrapy中的已抓取网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个爬行器,看起来像这样:
I have a crawler that looks something like this:
def parse:
.......
........
Yield(Request(url=nextUrl,callback=self.parse2))
def parse2:
.......
........
Yield(Request(url=nextUrl,callback=self.parse3))
def parse3:
.......
........
我想添加一个规则,其中如果URL在调用函数parse2时已经被抓取,但是要保留parse3的规则,我想忽略。我仍在探索requests.seen文件,看看是否可以处理。
I want to add a rule wherein I want to ignore if a URL has crawled while invoking function parse2, but keep the rule for parse3. I am still exploring the requests.seen file to see if I can manipulate that.
推荐答案
查看dont_filter请求参数
check out dont_filter request parameter at http://doc.scrapy.org/en/latest/topics/request-response.html
这篇关于如何忽略Scrapy中的已抓取网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!