I am trying to parse the given below html code using lxml.html and using CSSSelector instead of XPath.
link = doc.cssselect('html body div.results dl dt a)
the above code is giving me content-1 and content-2 as output but my desired output is link 1 link 2. So I replaced my code with
link = doc.cssselect('html body div.results dl dt a[href]')
but still am getting the same output. So my question is what's the proper CSS selector to get href attribute.
<div class = "results">
<div> some tags here </div>
<dl>
<dt title = "My Title 1" style = "background: transparent url('/img/accept.png') no-repeat right center">
<a href = "/link 1"> content-1</a>
</dt>
</dl>
<dl>
<dt title = "My Title 2" style = "background: transparent url('/img/accept.png') no-repeat right center">
<a href = "/link 2">content-2</a>
</dt>
</dl>
</div>