0
votes

Am trying to get the value from this link : view-source:https://www.otomoto.pl/ajax/misc/contact/multi_phone/6CLxXv/0/

the wanted values is : 42 677 17 00 i entered the scrapy shell then used : response.css('td.line-content::text').extract() and i got [] as a result.

i then tried with xpath : response.xpath('/html/body/table/tbody/tr/td[2]/text()').extract() and i got [] as a result.

why is it am not getting the wanted result , is there something am messing here ?

1

1 Answers

0
votes

I hope this may help you.

In [159]: response.xpath('//p/descendant-or-self::p[1]/text()').extract()[0].split(':')[1].split('}')[0]                                                                           
Out[159]: '"42 677 17 00"'

In [160]: print(response.xpath('//p/descendant-or-self::p[1]/text()').extract()[0].split(':')[1].split('}')[0])                                                                    
"42 677 17 00"

In [161]: print(response.xpath('//p/text()').extract()[0].split(':')[1].split('}')[0])                                                                                             
"42 677 17 00"