我可以通过
获取网址website =
pageForDetails.xpath('.//*[@id="akp_uid_8"]/div/div/div/div/div/div[1]/div/div[1]/div[2]/div[1]/div/div[1]/div/div[2]/div[1]/a/@href').extract_first()
示例结果是
In [54]: website
Out[54]: 'http://www.rrhotel.is/'
当我尝试通过
请求网址时yield Request(website,callback=self.parse_result,
meta={'name':name,
'website':website})
我收到如下错误
File "c:\programdata\anaconda3\lib\site-packages\scrapy\http\request\__init__.py", line 52, in _set_url
raise TypeError('Request url must be str or unicode, got %s:' % type(url).__name__)
TypeError: Request url must be str or unicode, got NoneType:
2017-11-17 00:47:18 [scrapy.core.engine] INFO: Closing spider (finished)
错误的原因是什么?如何摆脱它?提前谢谢。