我有这个 html 代码
<div class="featuredTorrent">
<ul>
<li>
<div class="torrentName">
<a href="/sub/2/0/" class="Movies" title="Movies > Divx/Xvid"></a>
<span class="nameComment">2</span> <h3 class="org"><a href="/torrent/394358/Batman-Dark-Knight-Returns-2012-Part-1-DVDRip-Xvid-AC3-Legend-Rg/" class="org">Batman.Dark.Knight.Returns.2012.Part.1.DVDRip.Xvid.AC3.Legend-Rg</a></h3>
<div class="clr"></div>
</div>
<span class="seed">1541</span>
<span class="leech">139</span>
<span class="size">803.67 MB</span>
<div class="user"><h4 class="vip"><a href="/user/scene4all/">scene4all</a> <sup title="Reputation Points">*5061</sup></h4></div>
<div class="clr"></div>
</li>
<li class="odd">
<div class="torrentName">
<a href="/sub/2/0/" class="Movies" title="Movies > Divx/Xvid"></a>
<h3 class="org"><a href="/torrent/394330/Batman-The-Dark-Knight-Returns-Part-1-2012-FRENCH-DVDRip-XviD-SLaP/" class="org">Batman.The.Dark.Knight.Returns.Part 1.2012.FRENCH.DVDRip.XviD-SLaP </a></h3>
<div class="clr"></div>
</div>
<span class="seed">1257</span>
<span class="leech">94</span>
<span class="size">699.04 MB</span>
<div class="user"><h4 class="uploader"><a href="/user/maximersk/">maximersk</a> <sup title="Reputation Points">*5003</sup></h4></div>
<div class="clr"></div>
</li>
我想用类种子、水蛭和大小检索“h3 class=org”和跨度。
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
url = "http://1337x.org/search/2012/0/"
document = webGet.Load(url)
Dim a, b As HtmlAgilityPack.HtmlNodeCollection
Dim s As HtmlAgilityPack.HtmlNode
Dim name, dUrl, seed, peer, size As String
a = document.DocumentNode.SelectNodes("//div[@class='torrentName']/h3[@class='org']")
For Each div As HtmlAgilityPack.HtmlNode In a
name = div.InnerText
Next
b = document.DocumentNode.SelectNodes("//div[@class='featuredTorrent']/ul/li")
For Each div As HtmlAgilityPack.HtmlNode In b
s = div.SelectSingleNode(".//span[@class='seed']")
TextBox1.Text = TextBox1.Text & s.InnerText & vbCrLf
Next
End Sub
我可以得到“h3”,但是跨度它给了我一个错误..我在敏捷包上找不到任何文档,也许我做错了方法..
如何在 for each 循环中选择所有需要类的跨度(应该已经在“li”节点中)?
提前致谢