【发布时间】:2019-10-01 19:54:54
【问题描述】:
我正在使用scrapy-splash 来抓取这个网站,蜘蛛给出“[twisted] CRITICAL: Unhandled error in Deferred:”
尝试了堆栈溢出和其他网站上的所有内容
我的蜘蛛代码
class DarazspidySpider(scrapy.Spider):
name = 'darazspidy'
def start_requests(self):
url = 'https://www.daraz.pk/smartphones/'
SplashRequest(url=url, callback=self.parse,
endpoint='render.html', args={'wait': 0.5})
def parse(self, response):
for phone in response.xpath('//div[@class="c5TXIP"]'):
yield {
'Name',
phone.xpath('.//*[contains(concat( " ", @class, " " ), concat( " ", "c16H9d", " " ))]//a').extract(),
'price',
phone.xpath('.//*[contains(concat( " ", @class, " " ), concat( " ", "c13VH6", " " ))]').extract(),
}
【问题讨论】:
-
你可以试试
yield你的SplashRequest吗? -
究竟是什么意思?
标签: python web-scraping scrapy scrapy-splash