I'm trying to parse a data from a request to add the links result into a listbox. Here is the html code which I'm trying split.
<div class="rc" data-hveid="411"><h3 class="r"><a href="http://google.com/" onmousedown="return rwt
<div class="rc" data-hveid="48"><h3 class="r"><a href="http://google2.com/" onmousedown="return rwt
Is just an example. They are a lot...
Here is my code. It works, but not correct.
Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("https://www.google.ro/search?q=Google")
Dim response As System.Net.HttpWebResponse = request.GetResponse
Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
Dim rssourcecode As String = sr.ReadToEnd
Dim pp As String = rssourcecode
Dim strRegex As String = "><a href="".*"""
Dim myRegex As New Regex(strRegex, RegexOptions.None)
For Each myMatch As Match In myRegex.Matches(pp)
If myMatch.Success Then
ListBox1.Items.Add(myMatch.Value.Split("""").GetValue(1))
End If
Next
This is the output: http://prntscr.com/9u000g/direct
Help me, please! I just want to get the first 5-6 websites links which Google show at first page.
Example: https://www.google.com/search?q=Google
Output: 1. https://www.google.com/