加速scrapy

def parse(self, response):
# Get the next index URLs and yield Requests
next_sel = response.xpath('//*[contains(@class,"next")]//@href') for url in next_sel.extract():
yield Request(urlparse.urljoin(response.url, url))

# Iterate through products and create PropertiesItems selectors = response.xpath(
'//*[@itemtype="http://schema.org/Product"]') for selector in selectors:
yield self.parse_item(selector, response)

 

posted @ 2017-12-13 10:07  不可叽叽歪歪  阅读(139)  评论(0编辑  收藏  举报