private string GetLinkFromSearchResult(string html) { string result = ""; if (string.IsNullOrEmpty(html)) { return(result); } HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(html); HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes("//p[@class='tmb']/a"); if (nodes != null) { foreach (HtmlNode node in nodes) { if (node == null) { continue; } string link = node.Attributes["href"]?.Value; if (link.IsProperUrl()) { string fanhao = Identify.GetFanhaoFromDMMUrl(link); if (Identify.GetEng(fanhao).ToUpper() == Identify.GetEng(ID).ToUpper()) { string str1 = Identify.GetNum(fanhao); string str2 = Identify.GetNum(ID); int num1 = 0; int num2 = 1; int.TryParse(str1, out num1); int.TryParse(str2, out num2); if (num1 == num2) { result = link; break; } } } } } return(result); }