class UrbanDictionary { public static string URL = "http://www.urbandictionary.com/define.php?term="; public static List> Search(string query) { List> ret = new List>(); try { string c = new WebClient().DownloadString(URL + HttpUtility.UrlEncode(query)); MatchCollection mc = Regex.Matches(c, "
(.*?)
"); MatchCollection mc2 = Regex.Matches(c, "(.*?)", RegexOptions.Singleline); if (mc.Count <= mc2.Count) { for (int i = 0; i < mc.Count; i++) { ret.Add(new KeyValuePair (mc2[i].Groups[1].Value.Trim(), System.Web.HttpUtility.HtmlDecode(mc[i].Groups[1].Value.Trim()))); } } } catch (Exception ex) { Trace.WriteLine("UrbanDictionary/Search Error: " + ex); } return ret; } }