Here's a pretty basic program I whipped up in like an hour to parse the Grand Exchange, and list items and stuff. Yeah, that's it.
Slightly based off of this thread.
The code should be relatively self-explanatory.
Code:
listView1.Items.Clear();
string ID, Name, Price, Change, Members;
WebClient client = new WebClient();
client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
listView1.BeginUpdate();
int CurrentPage = 0, PageCount = 0xFFFF;
while (CurrentPage < PageCount)
{
string Source = client.DownloadString("http://services.runescape.com/m=itemdb_rs/results.ws?page=" + (CurrentPage + 1).ToString() + "&query=" + txtSearch.Text + "&price=all&members=");
string[] ItemArray = Source.Split(new string[] { "<tr data-item-id=\"" }, System.StringSplitOptions.None);
if (PageCount == 0xFFFF)
{
PageCount = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(Source.Split(new string[] { "<em>" }, System.StringSplitOptions.None)[2].Split(new string[] { "</em>" }, System.StringSplitOptions.None)[0]) / 20));
}
this.Text = "Downloading page " + (CurrentPage + 1).ToString() + " of " + PageCount.ToString();
for (int i = 1; i <= ItemArray.Length - 1; i += 1)
{
ID = ItemArray[i].Split(new string[] { "\">" }, System.StringSplitOptions.None)[0];
Name = ItemArray[i].Split(new string[] { "alt=\"" }, System.StringSplitOptions.None)[1].Split('"')[0];
Price = ItemArray[i].Split(new string[] { "<td class=\"price\">" }, System.StringSplitOptions.None)[1].Split(new string[] { "</td>" }, System.StringSplitOptions.None)[0];
Change = ItemArray[i].Split(new string[] { "<td class=\"neutral\">", "<td class=\"positive\">", "<td class=\"negative\">" }, System.StringSplitOptions.None)[1].Split(new string[] { "</td>" }, System.StringSplitOptions.None)[0];
Members = ItemArray[i].Split(new string[] { "title=\"" }, System.StringSplitOptions.None)[1].Split(new string[] { "\">" }, System.StringSplitOptions.None)[0];
listView1.Items.Add(Name);
listView1.Items[listView1.Items.Count - 1].SubItems.Add(Price);
listView1.Items[listView1.Items.Count - 1].SubItems.Add(Change);
listView1.Items[listView1.Items.Count - 1].SubItems.Add(Members);
listView1.Items[listView1.Items.Count - 1].SubItems.Add(ID);
}
CurrentPage++;
}
listView1.EndUpdate();
Slightly based off of this thread.
The code should be relatively self-explanatory.




