敏捷新手在这里。给定输入文本:
<html>
... Lots of html here...
<label class="list_item_title">Yes</label><br /><br />
<div class="list_item">
<div style="width:425px;" class="left"><a href="/xyz">HIT1</a> (2012)</div>
<div style="width:190px;" class="right"></div>
</div>
<div class="list_item">
<div style="width:425px;" class="left"><a href="/abc">HIT2</a> (2012)</div>
<div style="width:190px;" class="right"></div>
</div>
<label class="list_item_title">No</label><br /><br />
<div class="list_item">
<div style="width:425px;" class="left"><a href="/xyz">IGNORE</a> (2012)</div>
<div style="width:190px;" class="right"></div>
</div>
... Lots of html here...
</html>
我想获得 HIT1 和 HIT2。
基本上算法是在标签节点(class =“list_item_title”)之后找到所有A的innerText,其中innerText =“Yes”