VB.NET得到一个特定的" href"通过id

时间:2016-06-09 15:11:55

标签: vb.net visual-studio-2010 html-agility-pack

我需要帮助才能开始使用我的应用。

我尝试在没有webbrowser的情况下从网页获取HREF链接。

我使用HtmlAgilityPack,但我无法获得特定的HREF:

<a id="ItemsList_file_0" title="HR9nqJCIqHex8niygKtwUHpdkjRGNaH22Oy54SPBmw.avi" href="http://dsa11.uverload.com/d/a012284e-1fd5-4317-82d3-9bf9e738f0a2/BIfmZ/0lOipBI/HR9nqJCIqHex8niygKtwUHpdkjRGNaH22Oy54SPBmw.avi" target="_blank">HR9nqJCIqHex8niygK..22Oy54SPBmw.avi</a><br />

我试试这段代码。

Dim webreq As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://www.uverload.com/view/0lOipBI")
Dim webres As System.Net.HttpWebResponse = webreq.GetResponse
Dim sr As System.IO.StreamReader = New System.IO.StreamReader(webres.GetResponseStream)
Dim docStr As String = sr.ReadToEnd
Dim HAPdoc As New HtmlAgilityPack.HtmlDocument

HAPdoc.LoadHtml(docStr)

Dim HAPnode As HtmlAgilityPack.HtmlNode
HAPnode = HAPdoc.GetElementbyId("ItemsList_file_0")
MsgBox(HAPnode.InnerText)

End Sub

什么都不给我

0 个答案:

没有答案