Try using Unicode string parameter for xpath() response.xpath(u'//span[text()="Plot Size (m²)"]/preceding::span/text()') Le 22 août 2015 15:00, "Mario" <laki-paki-suman...@hotmail.com> a écrit :
> I'm having issues with getting some values from this page: > > > http://www.remax-malta.com/Maisonette-For-Sale-St-Pauls-Bay-North_240041024-145 > > To be more specific here's a picture of what I can(colored green) and > can't(colored red) scrape: > > http://i.imgur.com/xT6wTtl.png > > Example of writing xpath for Total rooms is: > > response.xpath('//span[text()="Total Rooms:"]/preceding::span/text()'). > extract()[-1] > > This prints: u'3' which is value I'm after. > > But when I try to write xpath for Plot Size (m²) like this one: > > response.xpath('//span[text()="Plot Size (m²)"]/preceding::span/text()'). > extract()[-1] > > > I get this error: > > ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL > bytes or control characters > > > I know I get this because of '²' character. Can somebody help me out with > writing proper xpath? Or maybe there's another way of getting value from > xpath? > > -- > You received this message because you are subscribed to the Google Groups > "scrapy-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to scrapy-users+unsubscr...@googlegroups.com. > To post to this group, send email to scrapy-users@googlegroups.com. > Visit this group at http://groups.google.com/group/scrapy-users. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "scrapy-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to scrapy-users+unsubscr...@googlegroups.com. To post to this group, send email to scrapy-users@googlegroups.com. Visit this group at http://groups.google.com/group/scrapy-users. For more options, visit https://groups.google.com/d/optout.