Get URL image by Class

dragosdydy

Junior Member
Joined
Jan 23, 2012
Messages
116
Reaction score
50
Hi guys, I'm working on one of my projects and i encountered an issue. I don't know how to get a link for one image searching by it's class.
The link for the image is different for every URL but the image class is always the same.
The HTML code is something like that:

HTML:
<img id="251" alt="random_name" src="https://LinkOfTheImage.jpg" class="Picture img">


I think i must use the GetElementByClass but i dont how to get the src attribute.
Do you guys know how can i get the link of the image for every URL i search? Thanks.
 
I did it this way for the href tag of links.. tweak it for img and src..

Code:
        Dim nodes = doc.DocumentNode.SelectNodes("//a[@href]")
        For Each node As HtmlNode In nodes
            Dim att As HtmlAttribute = node.Attributes("href")
            If String_Contains(att.Value, "registr") Then
                ForReturn = Trim(att.Value)
            End If
        Next
 
Thanks for the reply. Have a nice day.
 
Back
Top