Quantcast
Channel: htmlagilitypack Forum Rss Feed
Viewing all articles
Browse latest Browse all 655

New Post: Link extraction problem

$
0
0
I think this code could help you
However, we have to change the code a bit, and if you're a professional programmer, you can use this code.
Public Function GetLinkAddress(ByVal HtmlSource As String) As String
        Dim LinkExtract As String = Nothing
        Dim htmldoc As New HtmlAgilityPack.HtmlDocument()
        htmldoc.LoadHtml(HtmlSource)
        Dim qq = From t In htmldoc.DocumentNode.Descendants("a") Where t.Attributes.Contains("href") _
                                              Select t
        For i As Integer = 0 To qq.Count - 1
            For m As Integer = 0 To qq(i).Attributes.Count - 1
                If qq(i).Attributes(m).Name = "href" Then
                    LinkExtract = qq(i).Attributes(m).Value
                    Exit For
                End If
            Next
        Next
        Return LinkExtract
End Function

Viewing all articles
Browse latest Browse all 655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>