public void FindTheMan(string keyWords) { MyWebClient wb = new MyWebClient(); string html = "https://en.wikipedia.org/wiki/Special:Random"; string[] names = keyWords.Split(' '); Console.WriteLine(wb.ReadPage(html)); AddCounter(); foreach (string s in names) { if (wb.ReadPage(html).Contains(s)) { Console.WriteLine("found {0} at depth {1}", s, GetCounter()); Console.WriteLine(html); return; } } SetAddresses(ExtractAllAHrefTags(html)); int listCount = GetAddresses().Count; for (int i = 0; i < listCount; i++) { AddCounter(); if (GetCounter() > GetMaxDepthOfSearch()) { Console.WriteLine("Actual depth is bigger than max depth"); return; } List <string> tmp = new List <string>(); for (int j = 0; j < GetAddresses()[i].Count; j++) { html = "https://en.wikipedia.org" + GetAddresses()[i][j]; Console.WriteLine(html); Console.WriteLine(wb.ReadPage(html)); foreach (string s in names) { if (wb.ReadPage(html).Contains(s)) { Console.WriteLine("found {0} at depth {1}", s, GetCounter()); Console.WriteLine(html); return; } } tmp.AddRange(ExtractAllAHrefTags(html)); } SetAddresses(tmp); listCount++; } }