0
我有一個scrapy蜘蛛,爲每個物品抓取兩個數量。問題是我必須使用float
方法,所以當發生其中一個被抓取的字段爲空時,我得到一個錯誤,並且蜘蛛停止抓取該頁面中的元素,並直接進入下一頁。Scrapy,錯誤後繼續爬行
有沒有可能告訴scrapy在錯誤後繼續爬行?這是我的蜘蛛的代碼。謝謝!
def parse(self, response):
for sel in response.xpath('//li[@class="oneclass"]'):
item = exampleItem()
item['quant1'] = float(sel.xpath('a/div/span[@class="exampleclass"]/span[@class="amount"]/text()'))
item['quant2'] = float(sel.xpath('div[@class="otherexampleclass"]/input/@max'))
yield item
完美,這就是我一直在尋找。我將其標記爲正確。 – Joe82