Пример #1
0
 private void GetOfferPage(string pageUrl)
 {
     try {
         WebPageResponse responseData = WebUtils.GetData(pageUrl, BotOptions);
         responseData.SetHtmlParser(_htmlParser);
         if (responseData.IsSuccess)
         {
             AddOfferStorage(responseData);
         }
     }
     catch (Exception e) {
         _eventLogger?.Error($"Url: {pageUrl}, Message: {e.Message} {e.StackTrace}");
     }
 }
        private IDocument AttemptWrapper(string pageUrl)
        {
            for (var i = 1; i < 3; i++)
            {
                try {
                    WebPageResponse htmlCode = GetDocument(pageUrl);


                    if (!htmlCode.IsSuccess)
                    {
                        continue;
                    }

                    htmlCode.SetHtmlParser(_htmlParser);
                    return(htmlCode.HtmlDocument);
                }
                catch (Exception ex) {
                    Logger.Warn($"{ex.Message}");
                }

                Logger.Warn($"Attempt №{i}");
            }
            return(null);
        }