27/06/14 1:02
Light
Salve, ho un problema.
Lavorando con il WebBrowser sono riuscito a prelevare un url di un'immagine con questo comando:
Dim theElementCollection As HtmlElementCollection
theElementCollection = Webbrowser1.Document.GetElementsByTagName("img"
For Each curElement As HtmlElement In theElementCollection
If curElement.GetAttribute("src".ToString().Contains("660187210687117" Then
PictureBox1.ImageLocation = curElement.GetAttribute("src".ToString()
MsgBox(curElement.GetAttribute("src".ToString())
End If
Next
Codice Html della pagina:
<a class="coverWrap coverImage" href="facebook.com/…; rel="theater" ajaxify="facebook.com/…; title="Immagine di copertina" id="fbCoverImageContainer" data-cropped="1"><img class="coverPhotoImg photo img" src="scontent-b-mxp.xx.fbcdn.net/hphotos-xpf1/t1.0-9/…; style="top:-231px;width:100%" data-fbid="660187210687117" alt="Immagine di copertina"><div class="coverBorder"></div><img class="coverChangeThrobber img" src="fbstatic-a.akamaihd.net/rsrc.php/v2/yk/r/…; alt="" width="16" height="16"></a>
Praticamente ho estratto "src" tramite: "data-fbid="660187210687117"
È possibile estrarre direttamente l'url dell'immagine ovvero:
scontent-b-mxp.xx.fbcdn.net/hphotos-xpf1/t1.0-9/…;
Tramite il nome della classe? Oppure è possibile estrarre il valore data-fbid?
Si può fare? Potete aiutarmi? Grazie in anticipo.
In rete ho trovato questo:
For Each ele As HtmlElement In Webbrowser1.Document.All
If ele.GetAttribute("src".ToLower.Contains(".jpg" Then
Dim imgsrc As String = ele.GetAttribute("src"
MsgBox(imgsrc)
End If
Next
Però questo estrae tutte le immagini .jpg
Lavorando con il WebBrowser sono riuscito a prelevare un url di un'immagine con questo comando:
Dim theElementCollection As HtmlElementCollection
theElementCollection = Webbrowser1.Document.GetElementsByTagName("img"
For Each curElement As HtmlElement In theElementCollection
If curElement.GetAttribute("src".ToString().Contains("660187210687117" Then
PictureBox1.ImageLocation = curElement.GetAttribute("src".ToString()
MsgBox(curElement.GetAttribute("src".ToString())
End If
Next
Codice Html della pagina:
<a class="coverWrap coverImage" href="facebook.com/…; rel="theater" ajaxify="facebook.com/…; title="Immagine di copertina" id="fbCoverImageContainer" data-cropped="1"><img class="coverPhotoImg photo img" src="scontent-b-mxp.xx.fbcdn.net/hphotos-xpf1/t1.0-9/…; style="top:-231px;width:100%" data-fbid="660187210687117" alt="Immagine di copertina"><div class="coverBorder"></div><img class="coverChangeThrobber img" src="fbstatic-a.akamaihd.net/rsrc.php/v2/yk/r/…; alt="" width="16" height="16"></a>
Praticamente ho estratto "src" tramite: "data-fbid="660187210687117"
È possibile estrarre direttamente l'url dell'immagine ovvero:
scontent-b-mxp.xx.fbcdn.net/hphotos-xpf1/t1.0-9/…;
Tramite il nome della classe? Oppure è possibile estrarre il valore data-fbid?
Si può fare? Potete aiutarmi? Grazie in anticipo.
In rete ho trovato questo:
For Each ele As HtmlElement In Webbrowser1.Document.All
If ele.GetAttribute("src".ToLower.Contains(".jpg" Then
Dim imgsrc As String = ele.GetAttribute("src"
MsgBox(imgsrc)
End If
Next
Però questo estrae tutte le immagini .jpg
aaa