xpath - Scrapy - Get all data within selector -


if have html in response looks like:

<body>     body text     <div>         div text     </div> </body> 

if response.xpath('//body/text()').extract() [body text]

i want everything inside <body> including tags i.e. whole thing:

body text <div>     div text </div> 

how can accomplish that?

thank you.

try it:

response.xpath('//body/node()/text()') 

or if want tags too:

response.xpath('//body/node()') 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -