scrapy报错集锦(持续更新)

报错1

xpath语句:

contents = response.xpath("(//div[@id='article_content']/text()) | (//div[@id='article_content']/br) | (//div[@id='article_content']/p/img)").extract()

报错:

ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters

解决办法:

contents = response.xpath(u"(//div[@id='article_content']/text()) | (//div[@id='article_content']/br)|(//div[@id='article_content']/p/img)").extract()

你可能感兴趣的:(scrapy报错集锦(持续更新))