Minecraft Scraper Tool - VB
I would very much appreciate it if someone could help in making a minecraft username scraper.
I'm not new to vb, but I am new to the whole scraping scene.
I have the code written out I could really use help with the regex.
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For i As Integer = 1 To 10
Dim k As String = "http://mcbans.com/" & i
Label1.Text = "Usernames Scraped: " & ListBox1.Items.Count
Dim source As String = New System.Net.WebClient().DownloadString(k)
Dim reg As Regex
reg = New Regex("need help here :)")
Dim Matches As MatchCollection = reg.Matches(source)
For Each UsernameString As Match In Matches
Dim s As String = UsernameString.Value.Split(">").GetValue(1)
Dim z As String = s.Split("<").GetValue(0)
If IsNumeric(z(0)) Then
ListBox1.Items.Add(z)
End If
Next
Next
End Sub
how regex works:
var = amazing>USERNAME</a>
RegExMatch(var, ">(.*)</a>", id)
id[0]
you set the pattern before and after the username and a "all" (.*) in between
easy peasy