I am facing a problem where I have to get the result from the child node which may or may not be parents to some other node using Xpath in scrapy. consider the case like
<h1 class="main">
<span class="child">data</span>
</h1>
or
<h1 class="main">
<span class="child">
<span class="child2">data</span>
</span>
</h1>
My solution was response.xpath(".//h1[@class='main']/span/text()").extract()