需要vb.net拆分帮助
我目前正试图从一个html网络源抓取一个化身,问题是有几个img源和容器具有相同的名称,这是我需要的当前部分需要vb.net拆分帮助,vb.net,Vb.net,我目前正试图从一个html网络源抓取一个化身,问题是有几个img源和容器具有相同的名称,这是我需要的当前部分 </div> <div class="content no_margin"> <img src="http://www.gravatar.com/avatar/4787d9302360d807f3e6f94125f7754c?&d=mm&r=g&s=250" /><br /> <br /&g
</div>
<div class="content no_margin">
<img src="http://www.gravatar.com/avatar/4787d9302360d807f3e6f94125f7754c?&d=mm&r=g&s=250" /><br />
<br />
<a class="link" href="http://sharefa.st/user/donkey">Uploads</a><br />
<a class="link" href="http://sharefa.st/user/donkey/favorites">Favorites</a><br />
</div>
</div>
<div id="content" class="left">
<div class="header">
Uploads
</div>
<div class="content no_margin">
<div class="profile_box">
<div class="profile_info">
上传
现在我需要抓住的部分是:
<img src="http://www.gravatar.com/avatar/4787d9302360d807f3e6f94125f7754c?&d=mm&r=g&s=250" /><br />
这张图片,任何帮助和我都将不胜感激 您似乎试图“手动”解析HTML。请不要
请参阅此问题以了解一些备选方案使用正则表达式查找您要查找的内容: 示例代码几乎演示了您的场景。请尝试:
Dim wb As New WebBrowser
wb.Navigate("")
Do While wb.ReadyState <> WebBrowserReadyState.Complete
Application.DoEvents()
Loop
wb.DocumentText = HtmlString 'Your Html
For Each img As HtmlElement In wb.Document.GetElementsByTagName("img")
If InStr(img.GetAttribute("src"), "avatar") Then
MsgBox(img.GetAttribute("src"))
End If
Next
Dim wb作为新的网络浏览器
wb.导航(“”)
执行While wb.ReadyState WebBrowserReadyState.Complete
Application.DoEvents()
环
wb.DocumentText=HtmlString'您的Html
对于wb.Document.GetElementsByTagName(“img”)中作为HtmlElement的每个img
如果是InStr(img.GetAttribute(“src”),“avatar”),那么
MsgBox(img.GetAttribute(“src”))
如果结束
下一个