Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Function getText() As String
- Dim web = New HtmlWeb()
- Dim html As HtmlDocument
- html = web.load("http://some-website.com")
- Dim lastLink = html.DocumentNode.SelectSingleNode("//div[@id='wrapper']//a[last()]")
- If lastLink IsNot Nothing Then
- Return lastLink.InnerHtml
- Else
- Return "nothing found"
- End If
- End Function
- Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
- label4.Text = getText()
- End Sub
- Private Function getText() As String
- Dim web = New HtmlWeb()
- web.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.36"
- Dim html As HtmlDocument
- html = web.load("http://some-website.com")
- Dim lastLink = html.DocumentNode.SelectSingleNode("//div[@id='wrapper']//a[last()]")
- If lastLink IsNot Nothing Then
- Return lastLink.InnerHtml
- Else
- Return "nothing found"
- End If
- End Function
- Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
- label4.Text = getText()
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement