• Log in or sign up for an account here: https://www.sythe.org/login

Grabbing things of a website such as runescape?

ViruZ3

Member
Joined
May 21, 2007
Sythe Gold
0
Messages
55
How do i grab things using Visual Basic 2008? People have Grand Exchange Parsers... How do i make one of those? Please help.
 
Two Factor Authentication User
Never use the INet control in .NET languages. Use the WebClient class instead:
Code:
''' <summary>Download the content (Html) code of a webpage.</summary>
''' <param name="Url">The Url of the webpage to download.</param>
Public Function DownloadString(ByVal Url As String) As String
    Static Client As New System.Net.WebClient()
    Return Client.DownloadString(Url)
End Function
 
Never use the INet control in .NET languages. Use the WebClient class instead:
Code:
''' <summary>Download the content (Html) code of a webpage.</summary>
''' <param name="Url">The Url of the webpage to download.</param>
Public Function DownloadString(ByVal Url As String) As String
    Static Client As New System.Net.WebClient()
    Return Client.DownloadString(Url)
End Function

Oh i have that... BUT im trying to get each line parsed out. Heres my code:
Code:
        NameBox.Text.Replace(" ", "_")
        Label1.Text = "Retriving hiscore data..."
        Dim UName As String = NameBox.Text
        Dim HiData As String = "http://hiscore.runescape.com/index_lite.ws?player=" & UName
        Dim WebC As New Net.WebClient()
        Dim UData = WebC.DownloadString(HiData)
        Dim Skills = 0
        For Each Line As String In HiData.Split(vbNewLine.ToCharArray, StringSplitOptions.RemoveEmptyEntries)
            Skills += 1
            TextBox1.Text = Skills
        Next
        Dim EditData = UData.Replace("-1", "N/A")
        Label1.Text = EditData
See the Skills count is supposed to add 1 for each line but its returning Skills = 1 for the hiscore data.
 
Two Factor Authentication User
You can convert strings to numbers with the function Integer.Parse.
Here is an example for getting those stats:
Code:
For Each Line As String In UData.Split(vbNewLine.ToCharArray, StringSplitOptions.RemoveEmptyEntries)
    Dim SplitData = Line.Split(",")
    Dim Rank = Integer.Parse(SplitData(0))
    Dim Level = Integer.Parse(SplitData(1))
    Dim Experience? = If(SplitData.Length = 3, Integer.Parse(SplitData(2)), Nothing)
Next
Experience? means that it can be nothing, so if there is no experience listed Experience will be Nothing instead of 0.
 
This is my code so far:
Code:
        NameBox.Text.Replace(" ", "_")
        Dim UName As String = NameBox.Text
        Dim HiData As String = "http://hiscore.runescape.com/index_lite.ws?player=" & UName
        Dim WebC As New Net.WebClient()
        Dim UData = WebC.DownloadString(HiData)
        Dim Skills = 0
        For Each Line As String In UData
            Dim EditData = UData.Replace("-1", "N/A")
            Dim SplitData = UData.Split(",")
            Dim Rank = Integer.Parse(SplitData(0))
            Dim Level = Integer.Parse(SplitData(1))
            Dim Experience = (SplitData(2))
            Label2.Text = "Rank: " + Rank.ToString + " Total Level: " + Level.ToString + " Total XP: " + Experience.ToString
            Me.Text = "Hiscore Grabber (" + UName + ": TL:" + Level.ToString + ")"
        Next
Im trying to parse out the rest of the skills not just the player rank, total level and total experiance. Can anyone help me?
 
duelarena.gg
Back
Top