Current code:
public static void WhoIsOnline(string worldName, WhoIsOnlineReceived callback)
{
string url = "http://www.tibia.com/community/?subtopic=worlds&world=" + worldName;
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.BeginGetResponse(delegate(IAsyncResult ar)
{
string html = GetHTML(ar);
MatchCollection matches = Regex.Matches(html, @"<TD WIDTH=70%><[^<]*>([^<]*)</A></TD><TD WIDTH=10%>([^<]*)</TD><TD WIDTH=20%>([^<]*)</TD></TR>");
List<CharOnline> chars = new List<CharOnline>(matches.Count);
CharOnline co;
for(int i = 0; i < matches.Count; i++)
{
co = new CharOnline();
co.Name = Prepare(matches[i].Groups[1].Value);
co.Level = int.Parse(matches[i].Groups[2].Value);
co.Vocation = Prepare(matches[i].Groups[3].Value);
chars.Add(co);
}
callback(chars);
}, request);
}
I was using this to scrape the online list, but they have changed their layout and I'm not sure how to change the regex to get the same information.
http://www.tibia.com/community/?subtopic=worlds&world=Libera
The link I am trying to use above.