Salve, mi scuso nuovamente per tutte le discussioni che apro.
Lavorando con il WebBrowser sono riuscito a prelevare un url di un'immagine con questo comando:
codice:
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:
codice:
<a class="coverWrap coverImage" href="https://www.facebook.com/photo.php?fbid=660187210687117&set=gm.705151156174642&type=1" rel="theater" ajaxify="https://www.facebook.com/photo.php?fbid=660187210687117&set=gm.705151156174642&type=1&src=https%3A%2F%2Fscontent-b-mxp.xx.fbcdn.net%2Fhphotos-xpf1%2Ft1.0-9%2F1656362_660187210687117_178605520_n.jpg&size=960%2C720&source=10&player_origin=events" title="Immagine di copertina" id="fbCoverImageContainer" data-cropped="1"><img class="coverPhotoImg photo img" src="https://scontent-b-mxp.xx.fbcdn.net/hphotos-xpf1/t1.0-9/1656362_660187210687117_178605520_n.jpg" style="top:-231px;width:100%" data-fbid="660187210687117" alt="Immagine di copertina"><div class="coverBorder"></div><img class="coverChangeThrobber img" src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yk/r/LOOn0JtHNzb.gif" alt="" width="16" height="16"></a>
Praticamente ho estratto "src" tramite: "data-fbid="660187210687117"
È possibile estrarre direttamente l'url dell'immagine ovvero:
codice:
https://scontent-b-mxp.xx.fbcdn.net/hphotos-xpf1/t1.0-9/1656362_660187210687117_178605520_n.jpg"
Tramite il nome della classe? Oppure è possibile estrarre il valore data-fbid?
Si può fare? Potete aiutarmi? Grazie in anticipo.
Mi scuso di nuovo.
In rete ho trovato questo:
codice:
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