Example #1
0
        public bool FindCover()
        {
            if (string.IsNullOrEmpty(_html))
            {
                throw new ParserException("Код не был загружен. Сначала выполните Download Html");
            }
            TextSearcher ts = new TextSearcher(_html);

            //ts.GoTo("b-gallery");
            //ts.Skip("gallery-list");
            //ts.Skip("gallery-link\" href=\"//");
            //string imageFilmUri = "https://" + ts.ReadTo("\" id");

            string[] imageFilmUriRelative = _html.Substrings("gallery-link\" href=\"//", "\" data-fallback", 0);
            var      imageFilmUri         = from q in imageFilmUriRelative
                                            let q1 = "https://" + q
                                                     select q1;

            foreach (var imageUri in imageFilmUri)
            {
                try
                {
                    _cover.Add(HtmlDownloadHelper.DownLoadImage(imageUri));
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
            return(false);
        }
 // получать чтмл
 // тру - успешло, фалс - ошибка
 public bool DownLoadHtml(string adress, List <string> goodUrlsList)
 {
     try
     {
         _html = HtmlDownloadHelper.DownloadHtml(string.Format(adress), Encoding.UTF8, goodUrlsList);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Example #3
0
 public bool DownLoadHtml(Request adress)
 {
     // 7 16.20
     try
     {
         _html = HtmlDownloadHelper.DownloadHtml(adress, Encoding.UTF8);
         return(true);
     }
     catch
     {
         return(false);
     }
 }