Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. Private Function getText() As String
  2. Dim web = New HtmlWeb()
  3. Dim html As HtmlDocument
  4.  
  5. html = web.load("http://some-website.com")
  6. Dim lastLink = html.DocumentNode.SelectSingleNode("//div[@id='wrapper']//a[last()]")
  7.  
  8. If lastLink IsNot Nothing Then
  9. Return lastLink.InnerHtml
  10. Else
  11. Return "nothing found"
  12. End If
  13.  
  14. End Function
  15.  
  16. Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
  17. label4.Text = getText()
  18. End Sub
  19.  
  20. Private Function getText() As String
  21. Dim web = New HtmlWeb()
  22. web.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.36"
  23. Dim html As HtmlDocument
  24.  
  25. html = web.load("http://some-website.com")
  26. Dim lastLink = html.DocumentNode.SelectSingleNode("//div[@id='wrapper']//a[last()]")
  27.  
  28. If lastLink IsNot Nothing Then
  29. Return lastLink.InnerHtml
  30. Else
  31. Return "nothing found"
  32. End If
  33.  
  34. End Function
  35.  
  36. Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
  37. label4.Text = getText()
  38. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement