private void ParsInfo(Zillow zillow) { Thread thread = new Thread(() => { LinkParser linkParser; ReqParametres reqParametres; do { //Парсим предварительную ссылку reqParametres = new ReqParametres(zillow.URL); reqParametres.SetUserAgent(Useragents.GetNewUseragent()); reqParametres.SetProxy(); linkParser = new LinkParser(reqParametres.Request); SavedCookies = linkParser.Cookies; } while (isCaptcha(linkParser.Data)); string newLink = linkParser.Data.ParsFromTo("<link rel=\"canonical\" href=\"", "\""); //Проверяем на неверную ссылку if (newLink.Contains("https://www.zillow.com/homes/for_sale/")) { zillow.Status = "No such adress"; } else { zillow.URL = newLink; do { reqParametres = new ReqParametres(zillow.URL); reqParametres.SetUserAgent(Useragents.GetNewUseragent()); reqParametres.SetProxy(); linkParser = new LinkParser(reqParametres.Request); } while (isCaptcha(linkParser.Data)); zillow.Status = CheckOnStatus(linkParser.Data.ToLower()).Replace("<span tabindex=\"0\" role=\"button\"><span class=\"zsg-tooltip-launch_keyword\">", "") .Replace("<Span Tabindex=\"0\" Role=\"Button\"><Span Class=\"Zsg-Tooltip-Launch_Keyword\">", ""); if (zillow.Status.Equals("Undefined")) { DebugBox.WriteLine(linkParser.Data); } else { //Zestimate set List <string> rawZestimate = linkParser.Data.ParsRegex("Zestimate<sup>®</sup></span></span>(.*?)\\$([0-9,./a-zA-Z]+)<", 2); if (rawZestimate.Count != 0) { zillow.Zestimate = "$" + rawZestimate[0]; } zillow.SoldPrice = CheckPrice(linkParser.Data); } SavedCookies = linkParser.Cookies; } threadCount--; progress++; DebugBox.WriteLine($"Обработано ссылок: {progress} из {results.Count}."); double val = 100.0f / results.Count * progress; WorkProgress.SetValue(val); }); thread.IsBackground = true; thread.Start(); }
public TelegramChecker(string url, int reconnects) { triesToConnect = reconnects; Url = url; LinkParser linkParser = null; do { ReqParametres req = new ReqParametres(url); _currentProxy = Proxies.GetProxy(); req.SetProxy(_currentProxy); req.SetTimout(8000); linkParser = new LinkParser(req.Request); }while (triesToConnect-- > 0 && linkParser.IsError); if (!linkParser.IsError) { string title = linkParser.Data.ParsFromTo("<title>", "</title>"); string data = linkParser.Data.ParsFromTo("<div class=\"tgme_page_extra\">", "</div>"); SetType(title, data); SetMembers(data); Proxies.ReturnProxie(_currentProxy); } else { IsError = true; } }