我是使用scrapy的新手。有谁能告诉我如何使以下代码工作?在我的蜘蛛中,它停在parse1。
谢谢!
def parse1(self,response):
response.meta['addedKey']=addedData1
self.parse_all(response)
def parse2(self,response):
response.meta['addedKey']=addedData2
self.parse_all(response)
def parse_all(self,response):
yield FormRequest(self.url,formdata={'key':response.meta['addedKey']},callback = self.someparser)
答案 0 :(得分:3)
您必须从生成器中获得parse1
:
def parse1(self,response):
response.meta['addedKey']=addedData1
for item in parse_all(response): # parse_all is a generator
yield item