scrapy抓取某些网站出现AttributeError_ object has no attribute 的解决办法的代码.txt

把写内容过程当中常常用的内容段备份一下,下面的内容内容是关于scrapy抓取某些网站出现AttributeError: 'Response' object has no attribute 'body_as_unicode'的解决办法的内容,应该是对码农们也有用。scrapy

 

def parse(self, response):
hxs=Selector(response)网站

for url in detail_url_list:
if 'goods' in url:
yield Request(url, callback=self.parse_detail)url





写成下面这个样子便可


code


def parse(self, response):
hxs=Selector(text=response.body)unicode

for url in detail_url_list:
if 'goods' in url:
yield Request(url, callback=self.parse_detail)object





注意这句话:hxs=Selector(text=response.body)

yield

相关文章
相关标签/搜索