2012-11-14 149 views
0

IM目前正試圖抓住從一個HTML網頁源的分身,probllem是具有相同的名稱,繼承人當前部分那裏有幾個IMG的來源和容器,我需要vb.net分幫助需要

</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 /> 

這張圖片任何幫助和感謝!

回答

1

嘗試:

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