Пример #1
0
        public List <Hrefs> GetHrefListFromURL()
        {
            List <Hrefs> list = new List <Hrefs>();
            string       pageUrlFormatString = "http://successfulenglish.com/learn/successful-english-blog/page/{0}/";
            string       pageUrl;

            for (int index = 1; index < 8; index++)
            {
                pageUrl = string.Format(pageUrlFormatString, index);

                HtmlNode rootNode = Common.GetRootNode(pageUrl);
                var      aNodes   = rootNode.QuerySelectorAll(".entry-title a");
                foreach (var node in aNodes)
                {
                    Hrefs entity = new Hrefs()
                    {
                        PageHref  = pageUrl,
                        CategoryA = "Successful English",
                        CategoryB = "Blog"
                    };
                    entity.ArticleHref = node.Attributes["href"].Value;
                    list.Add(entity);
                }
            }
            return(list);
        }
Пример #2
0
        public WebDavResponse(XElement response)
        {
            if (response == null)
            {
                throw new ArgumentNullException("response");
            }

            Element = response;

            Href  = response.GetElementPathValue(WebDavNames.Href);
            Hrefs = response.Elements(WebDavNames.Href)
                    .Select(h => h.Value)
                    .Skip(1);
            if (Hrefs.Any())
            {
                Status           = response.GetElementPathValue(WebDavNames.Status);
                PropertyStatuses = new WebDavPropertyStatus [0];
            }
            else
            {
                PropertyStatuses = response.Elements(WebDavNames.Propstat)
                                   .Select(propstat => new WebDavPropertyStatus(propstat));
            }

            Error = response.GetElementPath(WebDavNames.Error);
            if (Error != null)
            {
                Error = Error.Elements().FirstOrDefault();
            }

            ResponseDescription = response.GetElementPathValue(WebDavNames.ResponseDescription);
            Location            = response.GetElementPathValue(WebDavNames.Location, WebDavNames.Href);
        }
Пример #3
0
 public override string ToString()
 {
     return($"Title => {Title}\nDescription => {Description}\nResponse => {ResponseData.ToString()}\nH1 count => {H1Headers.Count()}\nHREFS count => {Hrefs.Count()}\nImage count => {Images.Count()}");
 }