private static void CheckProxy() { Console.WriteLine("Start proxy checking."); new Thread((() => { rawProxies.ForEach( proxy => { new Thread((() => { try { ReqParametres req = new ReqParametres("https://www.google.com/search?&q=gmail"); req.SetUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.53 Safari/537.36"); req.SetProxy(5000, proxy); LinkParser link = new LinkParser(req.Request); if (!link.IsError && link.Data.Contains("is email that")) { allProxies.Add(proxy); } } catch (Exception) { } })).Start(); }); })).Start(); while (allProxies.Count < 10) { Thread.Sleep(100); } }
private static void RefillProxyList() { ReqParametres req = new ReqParametres($"https://api.best-proxies.ru/proxylist.txt?key={bestProxyKey}&limit=0&type=http&response=10000"); LinkParser linkParser = new LinkParser(req.Request); Regex regex = new Regex("(\\d{1,3}\\.){3}\\d{1,3}:(\\d+)"); MatchCollection matches = regex.Matches(linkParser.Data); foreach (Match match in matches) { allProxies.Add(match.Groups[0].Value); } }