/// <summary> /// 根据链接获得代理IP /// </summary> /// <param name="ip"></param> /// <returns></returns> public static ConcurrentStack <string> GetIPByUrl(string url) { HashSet <string> ipHash = new HashSet <string>(); //请求获得代理ip栈 ConcurrentStack <string> stack = new ConcurrentStack <string>(); string html = HttpAdd.OnlyGetHtml(url); MatchCollection matches = Regex.Matches(html, @"\d+.\d+.\d+.\d+:\d+"); foreach (Match match in matches) { if (ipHash.Add(match.Value)) { stack.Push(match.Value); } else { } } return(stack); }