我正在尝试使用 Scrapy 抓取网站,但在抓取延迟加载产品时遇到问题。这是我的代码。
def parse(self, response):
hxs = HtmlXPathSelector(response)
sites = hxs.select('//ul[@id="productsCatalog"]/li')
items = []
for site in sites:
item = DmozItem()
item['link'] = site.select('a/@href').extract()
item['title'] = site.select('a/span[4]/text()').extract()[0].strip()
item['price'] = site.select('a/span[5]/span/text()').extract()
item['brand'] = site.select('a/span[3]/text()').extract()
items.append(item)
return items