Versions used: BS4, lxml, Python3.9
Say I have some HTML:
<div>
<p>Hello</p>
<h1>hi</h1>
<div id="hello"></div>
<h1>Hello</h1>
</div>
If I have some HTML selected: legal_div = soup.find(id="hello"), how could I discard or disregard any tag before that legal_div. I'd prefer to use lxml, but if it isn't possible, then html.parser is fine as well.
Edit: When I say discard, I mean that if I were to search for any <h1> tags, I should only see "Hello", not "hi"