我正在寻找一个解决方案,提出一个不允许的域检查出站链接的请求。在
但我的函数“parse_outboundLinks”从未被调用。在
我必须修改允许的域?在
谢谢你的帮助
我的代码:
name = "mySpider"
allowed_domains = ["monsite.fr"]
start_urls = ["http://www.monsite.fr/"]
rules = [Rule(SgmlLinkExtractor(allow=()),follow='true',callback='parse_item')]
def parse_item(self, response):
xlink = SgmlLinkExtractor(deny_domains=(self.allowed_domains[0]))
for link in xlink.extract_links(response):
Request(link.url, callback=self.parse_outboundLinks)
def parse_outboundLinks(self, response):
print response.status
只有在指定了
yield
时,才会调用Parse函数。将
Request(link.url, callback=self.parse_outboundLinks)
更改为yield Request(link.url, callback=self.parse_outboundLinks)
其他线程也存在类似问题。
scrapy's Request function is not being called
相关问题 更多 >
编程相关推荐