I have the following HTML code:
<div class="sites-split">
<ul>
<li><a href="http://www.page1.com/" target="_blank">text 1</a></li>
<li><a href="http://www.page2.com/" target="_blank">text 2</a></li>
</ul>
<ul>
<li><a href="http://www.page3.com/" target="_blank">text 3</a></li>
<li><a href="http://www.page4.com/" target="_blank">text 4</a></li>
</ul>
</div>
I want to extract te links and the text associated to that link, I manage to get the links by doing:
response.css("div.sites-split a::attr(href)").getall()
But I don't know how to get the text, I tried:
response.css("div.sites-split a::attr(target)").getall()
But all I get is:
['_blank',
'_blank',
'_blank',
'_blank']